a question

Steve Holden steve at holdenweb.com
Wed Jan 19 15:21:52 EST 2005


Will Stuyvesant wrote:

> Andrew Koenig wrote:
> 
>>how about writing this instead?
>>
>>    ('this is a '
>>     'long string')
> 
> 
> Yes, nice.  And to make that possible we have to write
> ('one-string-item',) instead of ('one-string-item') if we want a tuple
> with one string inside.  Sometimes that feels like a wart to me, but
> now I know it, sometimes not.
> 
That has very little to do with tuples. You could just as easily write

     'this is a '\
     'long string'

It's the dangling comma that's required to specify a tuple:

  >>> 1,
(1,)
  >>>

regards
  Steve
-- 
Steve Holden               http://www.holdenweb.com/
Python Web Programming  http://pydish.holdenweb.com/
Holden Web LLC      +1 703 861 4237  +1 800 494 3119



More information about the Python-list mailing list