List/Tuple bug or feature?
Gillou
nospam at bigfoot.com
Tue Sep 24 18:38:30 EDT 2002
"Mahesh Padmanabhan" <news at nospam.eml.cc> a écrit dans le message de news:
8765wv6o0d.fsf at nospam.eml.cc...
>
> Hi,
>
> I spent a lot of frustrating hours tracking this down and I am
> confused as to why I see this behavior.
>
> >>> x = ('a' 'b')
> >>> x
> 'ab'
>
> >>> x = ['a' 'b']
> >>> x
> ['ab']
>
It's a feature that may be helpful for making long strings without '\n' in
it (i.e. long regexps with comments).
longstring = (
'this is long ' # the first
...
'this is long '
'this is long ' # the hundredth
'this is long ')
Have a look at the tutorial (don't remember where exactly)
--Gilles
More information about the Python-list
mailing list