Should we deprecate comma?
Russel Winder
russel at winder.org.uk
Mon Mar 24 06:17:59 PDT 2014
On Mon, 2014-03-24 at 13:00 +0000, w0rp wrote:
[…]
>
> Consider the following.
>
> >>> (1, 2)
>
> (1, 2)
>
> >>> (1)
>
> 1
>
> >>> (1 * (3 * 4,))
>
> (-1, )
>
> >>> (1 * (3 - 4,) * 2)
>
> (-1, -1)
>
> >>> foo = lambda : 3
>
> >>> (
> ... foo()
> ... )
>
> 3
>
> >>> (
> ... foo(),
> ... )
>
> (3, )
>
> I see this kind of confusion happen often, and the convenient
> syntax becomes a burden.
The moral of the story is that if you want to avoid the situation Python
is in, then do not use ( and ) as delimiters for expressions and also
something else semantically different.
--
Russel.
=============================================================================
Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.winder at ekiga.net
41 Buckmaster Road m: +44 7770 465 077 xmpp: russel at winder.org.uk
London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
More information about the Digitalmars-d
mailing list