__getattr__ functionality for modules?
Stefan Franke
franke at ableton.com
Sun May 18 19:34:30 EDT 2003
On 18 May 2003 18:55:20 -0400, aahz at pythoncraft.com (Aahz) wrote:
...
>Nope, and Guido is violently opposed to making this possible. Why not
>just use a class?
Because a namespace object behaves different when it comes to setting
attributes: There are no nested scopes.
What I'm trying to realize is a small domain specific configuration
language: A subset of Python that consists of nothing else but
- a couple of functions,
- the ability to define your own functions with 'def' with correct scope nesting
- Python's numeric expressions
- and an (unlimited) number of builtin constants. That's what I need
the module getattr hook for
This is absolutely trivial to learn for the users in my context. Using
objects and attributes here adds an unnecessary (and unwanted)
level of complexity.
Stefan
More information about the Python-list
mailing list