Author ncoghlan
Recipients ncoghlan, serhiy.storchaka
Date 2017-11-14.10:25:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
The compiler currently allows parentheses to be omitted if a generator expression is the sole entry in a base class list:

    >>> class C(x for x in []): pass
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    TypeError: cannot create 'generator' instances

The language reference states that the parentheses around a generator expression are only optional for "calls with only one argument":

A base class list is not a call, so this should be treated as a syntax error, rather than being handled as equivalent to `class C((x for x in [])): pass`
Date User Action Args
2017-11-14 10:25:04ncoghlansetrecipients: + ncoghlan, serhiy.storchaka
2017-11-14 10:25:04ncoghlansetmessageid: <>
2017-11-14 10:25:03ncoghlanlinkissue32023 messages
2017-11-14 10:25:03ncoghlancreate