How do you create constants?
KevinL
darius at bofh.net.au
Tue Oct 31 09:07:14 EST 2000
>>> "Alex Martelli" wrote
> Me, I'd happily settle for a couple of state-bits on
> dictionaries -- whether to allow rebinding of existing
> entries, whether to allow creation of new entries. This
> has modest usefulness (and, if one had to choose, the
> alternative of being able to use general mapping objects
> wherever dictionaries are currently allowed would no
> doubt be more general -- allowing this tweak as well as
> others, such as user-mappings with per-key 'constness',
> and others yet not related to constness as well), but
> it seems to me it could be implemented easily, with clean
> and unsurprising semantics, and no serious performance
> implications...
Heya,
Being able to create read-only dictionaries that were useable as namespace
objects would be an immensely useful thing - if someone's taking votes for new
features, that one gets mine ;) I have a project that includes a multi-user
python shell, and being able to share the same global namespace between all
activity within that shell (and within the system generally) without concerns
as to bits of it being subverted would be a lifesaver. At the moment, every
time a method is bound to anything, it gets its own copy of the global
namespace that provides a bunch of utility functions (like parts of
__builtins__), which I consider fairly kludgy.
Being able to use full instances in place of dictionaries for namespace
objects would be even better, but I've been labouring under the belief for a
long time that the performance penalty involved there is atrocious?
The requirement for using full pythonic dictionaries instead of object
instances is one that's been annoying me for a while - feels like an
implementation bug stopping a conceptually clean approach to solving certain
problems...
KevinL
More information about the Python-list
mailing list