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
Web-SIG@python.org
Web SIG: http://www.python.org/sigs/web-sig
Unsubscribe: 
http://mail.python.org/mailman/options/web-sig/archive%40mail-archive.com

Reply via email to