Re: OT: dotted names (Was: Re: A Python Web Application Package and Format)

"P.J. Eby" <pje-Wh6+Hckhi6HFNGf7iClzIwC/[email protected]>
Newsgroups gmane.comp.python.web
Message-ID <[email protected]>
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.  ;-)  (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.

Either you have to get an AttributeError first, and then fall back to 
importing, or get an ImportError first, and fall back to getattr.

If the syntax is explicit, OTOH, then you don't have to guess, 
thereby saving lots of work and wasteful exceptions.

_______________________________________________
Web-SIG mailing list
[email protected]
Web SIG: http://www.python.org/sigs/web-sig
Unsubscribe: http://mail.python.org/mailman/options/web-sig/gcpw-web-sig%40m.gmane.org
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.