Extending built-in objects/classes

Jon Clements joncle at googlemail.com
Mon Jul 3 08:01:01 EDT 2006


John Machin wrote:
(snip)
>
> You have already been told: you don't need "self.<what>", you just write
> "self" ... self *is* a reference to the instance of the mystr class that
> is being operated on by the substr method.
>
(snip)

I get that; let me clarify why I asked again.

As far as I'm aware, the actual representation of a string needn't be
the same as its 'physical' value. ie, a string could always appear in
uppercase ('ABCD'), while stored as 'aBcd'. If I need to guarantee that
substr always returned from the physical representation and not the
external appearance, how would I do this? Or, would self, always return
internal representation, (if so, how would I get external appearance?).

Or I could be talking complete _beep_ - in which case I apologise.

Jon.




More information about the Python-list mailing list