data strucutures in python
Steven D. Majewski
sdm7g at virginia.edu
Tue Sep 19 20:04:08 EDT 2000
On 19 Sep 2000, Donn Cave wrote:
>
> That doesn't just happen to be unsupported by Python, there's a hint
> of alien weirdness to it. Not because something's happening by magic
> (that's all too common in Python) but because it looks like the variable
> is an object with properties, that can have a value assigned to it.
>
> In Python, the left hand side of those assignments is only a name, and
> each name has only one property, the object assigned to it. So what
> you want, in these terms, is a namespace where you can intervene in
> the assignment of names.
>
> The namespace where you type "lambda = 10" is not, so far as I know,
> a place where you can do this, but you can in a class instance, with
> the __setattr__() method.
Really *sick* suggestion:
How about writing a class to replace a modules __dict__ so that
assigning to an attribute does some magic in the module namespace?
---| Steven D. Majewski (804-982-0831) <sdm7g at Virginia.EDU> |---
---| Department of Molecular Physiology and Biological Physics |---
---| University of Virginia Health Sciences Center |---
---| P.O. Box 10011 Charlottesville, VA 22906-0011 |---
"All operating systems want to be unix,
All programming languages want to be lisp."
More information about the Python-list
mailing list