Language "macros" in discussions
Clarification: I have a tendency to mention constructs from other threads in a discussion. This might suggest that I'm propose using this not-yet-included or even accepted feature as a solution. For instance Guido's reaction to my last message might be an indicator of misinterpreting this, although I'm not sure if I was Prinarily addressed at all (despite that the to/cc suggested it). Anyway, I just want to make sure: If I'm mentioning stackless or codef or greenlet, this does not imply that I propose to code the solution to async by implementing such a thing, first. The opposite is true. I mean such meantioning more like a macro-like feature: I'm implementing structures using the existing things, but adhere to a coding style that stays compatible to one of the mentioned principles. This is like a macro feature of my brain - I talk about codef, but code it using yield-from. So please don't take me wrong that I want to push for features to be included. This is only virtual. I use yield constructs, but obey the codef protocol, for instance. And as an addition: when I'm talking of generators implemented by yield from, then this is just a generator that can yield from any of its sub-functions. I am not talking about tasks or schedulars. These constructs do not belong there. I'm strongly against using "yield from" for this. It is a building block for generatos resp. coroutines, and there it stops ! Higher level stuff should by no means use those primitives at all. Sent from my Ei4Steve
On Sat, Oct 20, 2012 at 1:55 PM, Christian Tismer <tismer@stackless.com> wrote:
Clarification:
I have a tendency to mention constructs from other threads in a discussion. This might suggest that I'm propose using this not-yet-included or even accepted feature as a solution. For instance Guido's reaction to my last message might be an indicator of misinterpreting this, although I'm not sure if I was Prinarily addressed at all (despite that the to/cc suggested it).
Anyway, I just want to make sure:
If I'm mentioning stackless or codef or greenlet, this does not imply that I propose to code the solution to async by implementing such a thing, first. The opposite is true.
I mean such meantioning more like a macro-like feature: I'm implementing structures using the existing things, but adhere to a coding style that stays compatible to one of the mentioned principles.
This is like a macro feature of my brain - I talk about codef, but code it using yield-from.
So please don't take me wrong that I want to push for features to be included. This is only virtual. I use yield constructs, but obey the codef protocol, for instance.
And as an addition: when I'm talking of generators implemented by yield from, then this is just a generator that can yield from any of its sub-functions.
I am not talking about tasks or schedulars. These constructs do not belong there. I'm strongly against using "yield from" for this. It is a building block for generatos resp. coroutines, and there it stops !
Higher level stuff should by no means use those primitives at all.
Ok, understood, and sorry if I mistook your intention before. Here's how I tend to use some terminology: - generator function: any function containing yield - generator object: the iterator returned by calling a generator function - generator: either of the above, when the context makes it clear which one I mean, or when it doesn't matter - iterator generator: a generator used to produce values that one would consume with an implicit or explicit for-loop - coroutine: a generator function used to implement an async computation instead of an iterator - Future: something with roughly the interface but not necessarily the implementation of PEP 3148 - Deferred: the Twisted Deferred class or something with similar functionality (there are some in the JavaScript world) Note that I use coroutine for both PEP-342-style and PEP-380-style generators (i.e. "yield <future>" vs. "yield from <generator>"). The big difference between Futures and Deferreds is that Deferreds can easily be chains together to create multiple stages, and each callback is called with the value returned from the previous stage; also, Deferreds have separate callback chains for regular values and errors.
Sent from my Ei4Steve
Does it happen to have a 40-char wide screen? :-) -- --Guido van Rossum (python.org/~guido)
On 21.10.12 00:37, Guido van Rossum wrote:
On Sat, Oct 20, 2012 at 1:55 PM, Christian Tismer <tismer@stackless.com> wrote: ...
Sent from my Ei4Steve Does it happen to have a 40-char wide screen? :-)
Ah, sometimes I write from my iPhone, and I don't know how to do proper line breaks. Sometimes I break them line-by-line, sometimes I don't and rely on the email reader's wrapping. None is perfect. The iPhone 4S means 'iphone for Steve' for me, in memoriam ;-) cheers - chris -- Christian Tismer :^) <mailto:tismer@stackless.com> Software Consulting : Have a break! Take a ride on Python's Karl-Liebknecht-Str. 121 : *Starship* http://starship.python.net/ 14482 Potsdam : PGP key -> http://pgp.uni-mainz.de phone +49 173 24 18 776 fax +49 (30) 700143-0023 PGP 0x57F3BF04 9064 F4E1 D754 C2FF 1619 305B C09C 5A3B 57F3 BF04 whom do you want to sponsor today? http://www.stackless.com/
participants (2)
-
Christian Tismer
-
Guido van Rossum