This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author veky
Recipients David Hagen, John Hagen, abarry, barry, eli.bendersky, ethan.furman, kennethreitz, python-dev, rhettinger, veky, vstinner
Date 2016-08-19.19:33:58
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1471635238.99.0.083343639225.issue26988@psf.upfronthosting.co.za>
In-reply-to
Content
# Just wait until I put the keys to the time machine in their usual place... :-)

Ok, while we're talking about whether declarative style is a good idea, Python has already got the initial seed of that style. With Guido's blessing! PEP 526 enables us to mix declarative and imperative style in "ordinary" code, so we can write

    @Enum
    class Color:
        green: member
        yellow: member

without any additional syntax. I think it satisfies everyone: there are no parentheses, and there are no assignments. [_And_ there is no misleading analogy with existing syntax, because this is a new syntax.:] There are just declarations, and the decorator instantiates them.

Decorator is needed because formally we need to exclude the type checking semantics, and the only official way currently is through a decorator. But in fact we can use the forward references to _actually_ annotate the members with their real type:

    class Color(Enum):
        green: 'Color'
        yellow: 'Color'

And once the forward references get a nicer syntax, and the unpacking issues are solved, we'll be able to write

    class Color(Enum):
        green, yellow: Color

And I think finally everyone will be happy. :-)
History
Date User Action Args
2016-08-19 19:33:59vekysetrecipients: + veky, barry, rhettinger, vstinner, eli.bendersky, ethan.furman, python-dev, abarry, John Hagen, David Hagen, kennethreitz
2016-08-19 19:33:58vekysetmessageid: <1471635238.99.0.083343639225.issue26988@psf.upfronthosting.co.za>
2016-08-19 19:33:58vekylinkissue26988 messages
2016-08-19 19:33:58vekycreate