◐ Shell
clean mode source ↗

Message 306159 - Python tracker

Currently,

    Class C(*some_classes): ...

works 'as expected' and is within grammar and language specification whereas

    Class C(x for x in [object]): ...

does not work but does not cause a syntax error. I can see a use case for both in dynamic class factories. I was going to do this, but was thwarted by another issue (__doc__ cannot be assigned after creation, nor can it be defined as anything but a pure string, any work around or reason that is the case? Not true for e.g. functions).

I think having one of these within the language specification and not the other is odd.