Thoughts about Python

Marco Aschwanden PPNTWIMBXFFC at spammotel.com
Wed Feb 25 04:34:09 EST 2004


> >*** Problem: clumsy properties for classes
> 
> The problem is currently under discussion.  Your fix is based on thinking
> 'self' to be a keyword, which it is not, instead of a usage convention for
> English language programmers.

Thanks! Now I know where my thinking went wrong... self is "another"
soft Python contract. This was now a real enlightment! I intermingled
Java's <this> with Python's <self>. They are not the same and <self>
is not "automatic".

> Quiz: how would you rewrite map(len, ['abc', (1,2,3,4), [5,6]]) if len()
> were a method?

The quiz is already (and very elegantly and better readable) solved
with a comprehension list. The OO-technique used is called
polymorphism... 8o).

Thanks for the hint on <self> is not "system var".
Cheers,
Marco



More information about the Python-list mailing list