[Python-ideas] Statement local functions and classes (aka PEP 3150 is dead, say 'Hi!' to PEP 403)

Nick Coghlan ncoghlan at gmail.com
Mon Oct 17 07:46:40 CEST 2011


On Mon, Oct 17, 2011 at 2:57 PM, Georg Brandl <g.brandl at gmx.net> wrote:
>   I can believe that others see the "given" semantics as the natural order
>   of things.  This is probably why Haskell has both "let x = y in z" and
>   "z where x = y" constructs to locally bind names, but there it fits well
>   with the syntax, while in the case of Python, the "given: suite" feels
>   somewhat out of place; we really have to think hard before adding new
>   syntax -- one more thing that the "casual" users Nick mentioned have to
>   grok.

Yeah, that's a large part of why I now think the given clause needs to
be built on the same semantics that we already use internally for
implicit out of order evaluation (i.e. decorators, comprehensions and
generator expressions), such that it merely exposes the unifying
mechanic underlying existing constructs rather than creating a
completely new way of doing things. I'm also interested in any
examples people have of APIs that engage in "decorator abuse" to get
the kind of declarative API I'm talking about.

it would be nice to be able to explain classes in terms of the same
underlying construct as well, but that gets rather messy due to the
fact that classes don't participate in lexical scoping and you have
the vagaries of metaclasses to deal with.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia



More information about the Python-ideas mailing list