For review: PEP 308 - If-then-else expression

Andrew Bennetts andrew-pythonlist at puzzling.org
Mon Feb 10 00:19:29 CET 2003


On Sun, Feb 09, 2003 at 05:20:41PM -0500, Roy Smith wrote:
> 
> I don't follow.  What's an "instance method" as opposed to a "class 
> method"?  What I was trying to say is that I think instead of:
> 
> >>> breakfastItems = ['spam', 'eggs', 'spam', 'spam', 'spam', 'and spam']
> >>> ', '.join (breakfastItems)
> 'spam, eggs, spam, spam, spam, and spam'
> 
> it should have been:
> breakfastItems.join (', ')

Then how do you join a tuple?  Or a sequence from an iterator?

I sometimes use this:
    str.join(',', ['spam', 'etc'])

Does that look better to you?

-Andrew.






More information about the Python-list mailing list