6 Jul 2011 20:33
Re: OT: dotted names
On 2011-04-15 22:33:08 +0000, P.J. Eby said: > At 04:11 PM 4/15/2011 -0400, Fred Drake wrote: >> These end users don't really care if the object identified is a class or >> function in module, a nested attribute on a class, or anything else, so >> long as it does what it's advertised to do. By not pushing implementation >> details into the identifier, the package maintainer is free to change the >> implementation in more ways, without creating backward incompatibility. > > That would be one advantage of using entry points > instead.(Continue reading)(i.e., the user doesn't specify the object location, > the package author does.) > > Note, however, that one must perform considerably more work to > resolve a name, when you don't know whether each part of the name is > a module or an attribute. Not if, as you mention, you use an explicit format. The format my resolver code uses (and this code is utilized in marrow.mailer for manager/transport lookup, marrow.server.http's command-line script to resolve WSGI applications, and marrow.templating to resolve templates) covers the following: :: <object> :: entrypoint_name :: ../relative/path/to/something :: ./relative/path/to/something :: /absolute/path/to/something :: package.relative/path/to/something :: package.absolute.path
(i.e., the user doesn't specify the object location,
> the package author does.)
>
> Note, however, that one must perform considerably more work to
> resolve a name, when you don't know whether each part of the name is
> a module or an attribute.
Not if, as you mention, you use an explicit format. The format my
resolver code uses (and this code is utilized in marrow.mailer for
manager/transport lookup, marrow.server.http's command-line script to
resolve WSGI applications, and marrow.templating to resolve templates)
covers the following:
:: <object>
:: entrypoint_name
:: ../relative/path/to/something
:: ./relative/path/to/something
:: /absolute/path/to/something
:: package.relative/path/to/something
:: package.absolute.path
RSS Feed