Miles semanticist at
Sun Jul 13 23:33:37 CEST 2008

On Sun, Jul 13, 2008 at 12:55 PM, mk <mrkafk at> wrote:
> So my updated question is where does this lstr() instance keep the original
> value ('abcdef')? It obviously has smth to do with inheriting after str
> class, but I don't get the details of the mechanism.

Through the str.__new__ method:

Calling a constructor:
foo = Foo(1, 2, 3)

Is roughly equivalent to:
foo = Foo.__new__(Foo, 1, 2, 3)
Foo.__init__(foo, 1, 2, 3)

As a side note, you may already know this, but it's not necessary to
create a property setter that raises an error to make a property
read-only; you can simply not define a setter method.


More information about the Python-list mailing list