Read-only attribute in module

Arnaud Delobelle arnodel at gmail.com
Fri Feb 10 05:09:24 EST 2012


On 10 February 2012 03:27, Terry Reedy <tjreedy at udel.edu> wrote:
> On 2/9/2012 8:04 PM, Steven D'Aprano wrote:
>
>> Python happily violates "consenting adults" all over the place. We have
>> properties, which can easily create read-only and write-once attributes.
>
>
> So propose that propery() work at module level, for module attributes, as
> well as for class attributes.

I think Steven would like something else: bare names that cannot be
rebound. E.g. something like:

>>> const a = 42
>>> a = 7

Would raise an exception.  Is that right?

-- 
Arnaud



More information about the Python-list mailing list