exception message output problem

Lie Lie.1296 at gmail.com
Sat Dec 22 03:46:37 EST 2007


On Dec 22, 6:18 am, Bruno Desthuilliers
<bdesth.quelquech... at free.quelquepart.fr> wrote:
> Lie a écrit :
> (snip)
>
> > # Python have an odd (read: broken) singleton implementation
> > # single member tuple must have a comma behind it
>
> You may call it weird or even a wart if you want, but given that what
> makes the tuple is the comma - not the parens[1] -, it is _not_ broken.
>
> [1] with the exception of the empty tuple.


I also realized that you don't need to use parens to make tuple, it's
rather my habit to always use parens in making a tuple (because "print
'%s + %s + %s' % (a, b, c)" _must_ have a parens (otherwise Python
thinks b and c is arguments for the print not for the string
formatting) and because Python always return a tuple w/ parens)

PS: My wording on broken doesn't actually means broken so it won't
work, but rather broken syntactically, making the syntax inconsistent,
funny, illogical, etc. One could argue though that the trailing comma
is a formalized workaround.



More information about the Python-list mailing list