Johannes Zellner wrote:
> can I make an object read-only, so that
>
> x = new_value
>
> fails (and x keeps it's orginal value)?
the original x does contain the original value; assignment only changes
the binding in the target namespace. you cannot override this.
you can control attribute as
Johannes Zellner wrote:
> Hi,
>
> can I make an object read-only, so that
>
> x = new_value
>
> fails (and x keeps it's orginal value)?
Simon gave you a way of doing it when x is an attribute access (e.g.
p.x). I am unaware of a way of doing it when x is a straight global or
local. Unlike
On 18 Jan 2006 11:59:23 GMT, Johannes Zellner <[EMAIL PROTECTED]> wrote:
> Hi,
>
> can I make an object read-only, so that
>
> x = new_value
>
> fails (and x keeps it's orginal value)?
This works for me:
http://groups.google.com/group/comp.lang.python/msg/2b1785397358ff90
--
Cheers,
Simon B,
Hi,
can I make an object read-only, so that
x = new_value
fails (and x keeps it's orginal value)?
This would be especially of interest for me for an object created by
a c extension.
--
Johannes
--
http://mail.python.org/mailman/listinfo/python-list