Serhiy Storchaka added the comment:
set(x for x in range(2),) can be interpreted as set(x for x in (range(2),)).
Wouldn't be better to forbid such ambiguous syntax? The trailing comma in
argument list is supported because it helps to add new arguments (or temporary
comment out arguments).
foo(x,
y,
#z,
)
But set(x for x in range(2),) is not syntactically valid if add an argument
after the comma. Parenthesis around a generator expression can be omitted only
if it is the only argument in a function call. I think that it would be better
to forbid a trailing comma in this case.
----------
nosy: +serhiy.storchaka
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue27494>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com