However, it appears that somehow this object prints the value of 's' attribute without me setting any specific methods to do that:

 >>> astr = lstr('abcdef')
 >>> astr
'abcdef'
 >>> astr.swapcase()
'ABCDEF'

Correction: it doesn't really get the value from _s attribute:

>>> astr = lstr('abcdef')
>>> astr.s
'abcdef'
>>> astr.s='xyzzy'
>>> astr
'abcdef'
>>> astr.s
'xyzzy'


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.

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to