[Python-Dev] Autoloading? (Making Queue.Queue easier to use) (original) (raw)

Steven Bethard steven.bethard at gmail.com
Mon Oct 17 06:21:31 CEST 2005


Nick Coghlan wrote:

Having module attribute access obey the descriptor protocol (get, set, delete) sounds like a pretty good option to me.

It would even be pretty backwards compatible, as I'd be hardpressed to think why anyone would have a descriptor instance as a top-level object in a module (descriptor definition, yes, but not an instance).

Aren't all functions descriptors?

py> def baz(): ... print "Evaluating baz!" ... return "Module attribute" ... py> baz() Evaluating baz! 'Module attribute' py> baz.get(import(name), None) <bound method ?.baz of <module '__main__' (built-in)>> py> baz.get(import(name), None)() Traceback (most recent call last): File "", line 1, in ? TypeError: baz() takes no arguments (1 given)

How would your proposal change the invocation of module-level functions?

STeVe

You can wordify anything if you just verb it. --- Bucky Katt, Get Fuzzy



More information about the Python-Dev mailing list