[Python-Dev] Issues with PEP 482 (1)

Paul Sokolovsky pmiscml at gmail.com
Tue Apr 28 23:37:00 CEST 2015


Hello,

On Tue, 28 Apr 2015 21:00:17 +0100
Mark Shannon <mark at hotpy.org> wrote:

[]

> >> CO_COROUTINE = 0x0080
> >> CO_GENERATOR = 0x0020
> >>
> >> def coroutine(f):
> >>       'Converts a function to a generator function'
> >>       old_code = f.__code__
> >>       new_code = CodeType(
> >>           old_code.co_argcount,
> >>           old_code.co_kwonlyargcount,
> >
> >
> > This is joke right?
> Well it was partly for entertainment value, although it works on PyPy.
> 
> The point is that something that can be done with a decorator,
> whether in pure Python or as builtin, does not require new syntax.

And that's exactly not what Python is and not how it evolves. Unlike
Scheme, it doesn't offer some minimal orthogonal basis out of which
everything can be derived by functional application. Instead, it's more
pragmatic and offers plethora of (well defined, unlike many other
languages) concepts and implementations to choose from. And if so
happens that practice shows that some concepts needs "slight"
redefinition, such concept is defined as first-class, despite the fact
that it matches 90% semantics of another concept. Fortunately, on
implementation level, those 90% of semantics are shared, so it is not
outright "bloat".

The current wishful thinking of this PEP is that more people will know
and use "await", while "yield from" will keep being understood and used
by quite not every Python programmer.

(Just to state the obvious, all the above is actually my own
trying to grasp it, and is reverse causation - trying to explain Python
progress in terms of how this particular PEP482 and its older friends
progress, it may be quite different for other aspects of language. I
for one rather surprised that BDFL is so positive about this PEP). 

> 
> Cheers,
> Mark.
> 



-- 
Best regards,
 Paul                          mailto:pmiscml at gmail.com


More information about the Python-Dev mailing list