I come to praise .join, not to bury it...

Russell E. Owen owen at astrono.junkwashington.emu
Fri Apr 13 11:57:41 EDT 2001


>It would take little to write a collection class, but making
>_types_ (as opposed to _classes_) "inherit" from a class would
>require major surgery to Python.  As things stand, types just do
>not "inherit".  Lists, strings, Unicode strings, tuples,
>dictionaries and arrays (in standard module array) are all
>types.

Thanks. I realized that later when thinking more about it. Thanks for 
the helpful reference (elided; read Alex's message) to PEP 246. It 
sounds very helpful in this context.

>> - the % operator could work on any kind of collection; I occasionally
>> try to use a list instead of a tuple
>
>That would break existing code:
>
>>>> print "ba%sbo"%range(2)
>ba[0, 1]bo

Fascinating. I thought this was deprecated if not already illegal, as 
remember reading a threat to insist that % always have a tuple (or dict) 
to the right of it. Has that been rescinded? (Did I misread something?). 
I'd already reluctantly changed my coding style to accomodate the 
change. It's certainly tempting to leave out the (,) when one has a 
single item to print, and if this is Approved Style then I'm not going 
to cry over lists and list-like items needing a tuple() around them to 
act as tuples.

-- Russell



More information about the Python-list mailing list