[Python-Dev] Dynamic module namspaces (original) (raw)
glyph at divmod.com glyph at divmod.com
Mon Jul 17 18:59:23 CEST 2006
- Previous message: [Python-Dev] Dynamic module namspaces
- Next message: [Python-Dev] Dynamic module namspaces
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Mon, 17 Jul 2006 10:29:22 -0300, Johan Dahlin <jdahlin at async.com.br> wrote:
I consider getattribute a hack, being able to override dict is less hackish, IMHO.
Why do you feel one is more "hackish" than the other? In my experience the opposite is true: certain C APIs expect dict to be a "real" dictionary, and if you monkey with it they won't call the overridden functions you expect, whereas things accessing attributes will generally call through all the appropriate Python-level APIs.
This makes sense to me for efficiency reasons and for clarity as well; if you're trawling around in a module's dict then you'd better be ready for what you're going to get - especially if the module is actually a package. Even in "normal" python code, packages can have names which would be bound if they were imported, but aren't yet.
- Previous message: [Python-Dev] Dynamic module namspaces
- Next message: [Python-Dev] Dynamic module namspaces
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]