I'm not really worry that much over O(n^2) performace (especially
having optimized some O(n^3) SQL operations :-o !)
The things is this really should be an O(n) operation. Having a yield
all statement or expression is useful in its own right and also
potentially a way to optimized away the O(n^2)
<[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>>>unless you are going many levels deep
> (and that's usually a design smell of some kind)
>
> No, its not a bug. its a feature! See the discussion in the recursive
> generator thread below:
http://groups.google.com/group/comp.lang.pyth
>>unless you are going many levels deep
(and that's usually a design smell of some kind)
No, its not a bug. its a feature! See the discussion in the recursive
generator thread below:
http://groups.google.com/group/comp.lang.python/browse_frm/thread/4c749ec4fc5447fb/36f2b915eba66eac?q=recursive+ge
[EMAIL PROTECTED] wrote:
> dude - this business is so confusing that you actually have to *think*
> about it!
> but python is all about simplicity.
> with python, when I program - I don't think *about* it - I think it. or
> something - don't make me think about it.
>
> so how about a "reyield" or
dude - this business is so confusing that you actually have to *think*
about it!
but python is all about simplicity.
with python, when I program - I don't think *about* it - I think it. or
something - don't make me think about it.
so how about a "reyield" or some other new keyword (cause reyield i
This is why my original proposal used the '*' operator rather than a
keyword. The reasoning behind this is as follows: When calling a
function, a parameter of the form "*expression" expands to a list of
arguments. From the Python reference manual:
"If the syntax '*expression' appears in the functi
Reinhold Birkenfeld wrote:
> Kay Schluehr wrote:
> > Reinhold Birkenfeld wrote:
> >
> >> > x = [ yield r for r in iterable ]
> >>
> >> Which is quite different from
> >>
> >> x = (yield) in iterable
> >>
> >> which is currently (PEP 342) equivalent to
> >>
> >> _ = (yield)
> >> x = _ in iterable
>
Kay Schluehr wrote:
> Reinhold Birkenfeld wrote:
>
>> >x = [ yield r for r in iterable ]
>>
>> Which is quite different from
>>
>> x = (yield) in iterable
>>
>> which is currently (PEP 342) equivalent to
>>
>> _ = (yield)
>> x = _ in iterable
>>
>> So, no further tinkering with yield, I'm afra
Reinhold Birkenfeld wrote:
> > x = [ yield r for r in iterable ]
>
> Which is quite different from
>
> x = (yield) in iterable
>
> which is currently (PEP 342) equivalent to
>
> _ = (yield)
> x = _ in iterable
>
> So, no further tinkering with yield, I'm afraid.
>
> Reinhold
Is the statement
Matt Hammond wrote:
>> Well, maybe it's right both ways ;-) I.e., even though yield "is" now
>> an expression, it is valid to use it as an expression-statement which
>> evaluates the expression and discards the value. So I think you could
>> still use the currently illegal "yield in" token sequence
> Well, maybe it's right both ways ;-) I.e., even though yield "is" now
> an expression, it is valid to use it as an expression-statement which
> evaluates the expression and discards the value. So I think you could
> still use the currently illegal "yield in" token sequence to mean that
> what fol
On Tue, 30 Aug 2005 21:23:39 -0400, Peter Hansen <[EMAIL PROTECTED]> wrote:
>Bengt Richter wrote:
>> On Tue, 30 Aug 2005 23:12:35 +0200, Reinhold Birkenfeld <[EMAIL PROTECTED]>
>> wrote:
>>>Bengt Richter wrote:
Maybe
yield in inner()
could be sugar for the above and beco
Bengt Richter wrote:
> On Tue, 30 Aug 2005 23:12:35 +0200, Reinhold Birkenfeld <[EMAIL PROTECTED]>
> wrote:
>>Bengt Richter wrote:
>>>Maybe
>>> yield in inner()
>>>
>>>could be sugar for the above and become something optimized?
>>
>>The problem here is that yield isn't a statement any mor
On Tue, 30 Aug 2005 23:12:35 +0200, Reinhold Birkenfeld <[EMAIL PROTECTED]>
wrote:
>Bengt Richter wrote:
>> On Tue, 30 Aug 2005 12:18:59 GMT, Michael Hudson <[EMAIL PROTECTED]> wrote:
>>
>>>Talin <[EMAIL PROTECTED]> writes:
>>>
I'm finding that a lot of places within my code, I want to retu
Bengt Richter wrote:
> On Tue, 30 Aug 2005 12:18:59 GMT, Michael Hudson <[EMAIL PROTECTED]> wrote:
>
>>Talin <[EMAIL PROTECTED]> writes:
>>
>>> I'm finding that a lot of places within my code, I want to return the
>>> output of a generator from another generator. Currently the only
>>> method I kn
On Tue, 30 Aug 2005 12:18:59 GMT, Michael Hudson <[EMAIL PROTECTED]> wrote:
>Talin <[EMAIL PROTECTED]> writes:
>
>> I'm finding that a lot of places within my code, I want to return the
>> output of a generator from another generator. Currently the only
>> method I know of to do this is to explici
Talin <[EMAIL PROTECTED]> writes:
> I'm finding that a lot of places within my code, I want to return the
> output of a generator from another generator. Currently the only
> method I know of to do this is to explicitly loop over the results
> from the inner generator, and yield each one:
>
>
Talin wrote:
> I'm finding that a lot of places within my code, I want to return the
> output of a generator from another generator. Currently the only method
> I know of to do this is to explicitly loop over the results from the
> inner generator, and yield each one:
>
>for x in inner(
18 matches
Mail list logo