Implicit lists

Alex Martelli aleax at aleax.it
Mon Feb 3 02:17:16 EST 2003


Martin Maney wrote:
   ...
> or it might look like this, although it's IMO a bit less clear for
> this simple example:
> 
>     foo(('this string available'))

The doubling up of the parentheses here has absolutely no effect.

Maybe you mean to pass a singleton tuple, in which case you
need to use the following syntax:

      foo(('this string available',))

The easy-to-miss trailing comma is what denotes the singleton
tuple -- unpleasant, but I know of no better alternatives.


Alex





More information about the Python-list mailing list