Confused with methods

Alex Martelli aleaxit at yahoo.com
Tue Feb 8 03:24:09 EST 2005


jfj <jfj at freemail.gr> wrote:

> I just realized that I'm trolling.

I'm glad you're retracting your earlier assertion that "There is no
trolling involved here".  Everybody can err, but to admit and apologize
takes character: may I offer my warmest handshake.

Back when I was a Python newbie (and identified as such even in the
Subject of my early posts) I had my ideas about how Python should
change, too: it should grow a '__contains__' special method to let a
container optimize membership tests (the `in' operator); it should have
a specialized iterator protocol, rather than always relying on indexing
for iteration; it should be possible to subclass builtin types, e.g.
dictionary; ... you can read all about it on google, including my
request to """Please consider "IMHO"'s to be liberally inserted in what
follows, of course!-)."""

It turned out that __contains__ was already in the plans (which I did
not know about): I had even guessed the *name*!  The iterator protocol
and subclassing builtin types took a bit longer to appear (and the
eventual name was __iter__ while my original idea was __enum__; and it's
still not fully possible insert a subclassed dict anywhere a dict may be
used) but eventually they did.

And yet for all of this I ended up in a flamewar with the timbot
anyway... it solved itself and we made friends, but still, I'm quite
familiar with the pickles a newbie can get into;-).


Alex



More information about the Python-list mailing list