Python Mystery Theatre -- Episode 3: Extend this

Steven Taschuk staschuk at telusplanet.net
Tue Jul 22 07:45:24 EDT 2003


Quoth Raymond Hettinger:
  [...]
> Let me know if you learned something new along the way.
  [...]
> ACT IV ---------------------
> pets = list('cat ')
> pets += 'dog '
> pets.extend('fish ')
> print pets + 'python'

This one was new to me -- I was shocked and amazed to learn that
list.__iadd__, unlike list.__add__, accepts arbitrary iterables.

  [...]
> ACT VI -----------------------------------------
> print "What is the technical name for this algorithm or transformation?"
  [...]

Heh.  Nice one.

The technical name is "the identity transformation".

-- 
Steven Taschuk                               staschuk at telusplanet.net
"What I find most baffling about that song is that it was not a hit."
                                          -- Tony Dylan Davis (CKUA)





More information about the Python-list mailing list