Ok, we've added list comprehensions to the language, and seen that
they were good. We've added generator expressions to the language, and
seen that they were good as well.
I'm left a bit confused, though - when would I use a list comp instead
of a generator expression if I'm going to require 2.4 a
Mike Meyer wrote:
Ok, we've added list comprehensions to the language, and seen that
they were good. We've added generator expressions to the language, and
seen that they were good as well.
I'm left a bit confused, though - when would I use a list comp instead
of a generator expression if I'm going
Robert Kern wrote:
Mike Meyer wrote:
Ok, we've added list comprehensions to the language, and seen that
they were good. We've added generator expressions to the language, and
seen that they were good as well.
I'm left a bit confused, though - when would I use a list comp instead
of a generator expr
Steven Bethard wrote:
Robert Kern wrote:
Mike Meyer wrote:
Ok, we've added list comprehensions to the language, and seen that
they were good. We've added generator expressions to the language, and
seen that they were good as well.
I'm left a bit confused, though - when would I use a list comp inste
Robert Kern wrote:
Mike Meyer wrote:
Ok, we've added list comprehensions to the language, and seen that
they were good. We've added generator expressions to the language, and
seen that they were good as well.
I'm left a bit confused, though - when would I use a list comp instead
of a generator expr
jfj wrote:
Robert Kern wrote:
Mike Meyer wrote:
Ok, we've added list comprehensions to the language, and seen that
they were good. We've added generator expressions to the language, and
seen that they were good as well.
I'm left a bit confused, though - when would I use a list comp instead
of a gen
I jfj wrote:
make_fractal_with_seed (x for x in range(1) if fibonacci_prime
(x))
and this is stupendus.
At least range should be xrange.
jfj
--
http://mail.python.org/mailman/listinfo/python-list
Robert Kern wrote:
jfj wrote:
2) to convert a list/tuple/string to a list, which is
done extremely fast.
Add "any iteratable". Genexps are iterables.
The thing is that when you want to convert a tuple to a list
you know already the size of it and you can avoid using append()
and expanding the list
jfj wrote:
Robert Kern wrote:
jfj wrote:
2) to convert a list/tuple/string to a list, which is
done extremely fast.
Add "any iteratable". Genexps are iterables.
The thing is that when you want to convert a tuple to a list
you know already the size of it and you can avoid using append()
and expandin
jfj <[EMAIL PROTECTED]> writes:
> I think a better question would be "What do *generator expressions* do
> that list comprehensions don't?". And always use list comprehensions
> unless you want the extra bit.
As the OP, I can say why I didn't ask those questions.
Generator expressions don't bui
Mike Meyer wrote:
jfj <[EMAIL PROTECTED]> writes:
I think a better question would be "What do *generator expressions* do
that list comprehensions don't?". And always use list comprehensions
unless you want the extra bit.
As the OP, I can say why I didn't ask those questions.
Sorry. I was referri
On Sun, 24 Apr 2005 22:59:12 -0700, Robert Kern wrote:
> Never. If you really need a list
>
> list(x*x for x in xrange(10))
>
> Sadly, we can't remove list comprehensions until 3.0.
Why "remove" them? Instead, we have these things called "comprehensions"
(which, now that I say that, seems a rath
Jeremy Bowers wrote:
On Sun, 24 Apr 2005 22:59:12 -0700, Robert Kern wrote:
Never. If you really need a list
list(x*x for x in xrange(10))
Sadly, we can't remove list comprehensions until 3.0.
Why "remove" them? Instead, we have these things called "comprehensions"
(which, now that I say that, see
> "Jeremy" == Jeremy Bowers <[EMAIL PROTECTED]> writes:
Jeremy> On Sun, 24 Apr 2005 22:59:12 -0700, Robert Kern wrote:
>> Never. If you really need a list
>>
>> list(x*x for x in xrange(10))
>>
>> Sadly, we can't remove list comprehensions until 3.0.
Jeremy> Why
On 25 Apr 2005 23:33:48 +0300, Ville Vainio <[EMAIL PROTECTED]> wrote:
> > "Jeremy" == Jeremy Bowers <[EMAIL PROTECTED]> writes:
>
> Jeremy> On Sun, 24 Apr 2005 22:59:12 -0700, Robert Kern wrote:
> >> Never. If you really need a list
> >>
> >> list(x*x for x in xrange(10))
>
On Mon, 25 Apr 2005 16:48:46 -0400, Bill Mill wrote:
> On 25 Apr 2005 23:33:48 +0300, Ville Vainio <[EMAIL PROTECTED]> wrote:
>> Still, list comprehensions should be implemented in terms of genexps to
>> get rid of the LC variable that is visible outside the scope of the LC.
>>
>>
> +1 . I thin
Jeremy Bowers <[EMAIL PROTECTED]> writes:
> On Mon, 25 Apr 2005 16:48:46 -0400, Bill Mill wrote:
> generalizing anyways, which is the right approach. I doubt that Python 3.0
> would have two radically different implementations; they'll just have the
> genexp implementation, and an optimization for
On Mon, 25 Apr 2005 23:00:57 -0500, Mike Meyer wrote:
> Why do we have to wait for Python 3.0 for this? Couldn't list
> comprehensions and generator expression be unified without breaking
> existing code that didn't deserve to be broken?
We don't; my mentioning 3.0 was just in reference to a previ
On Mon, 25 Apr 2005 16:48:46 -0400, Bill Mill <[EMAIL PROTECTED]> wrote:
>On 25 Apr 2005 23:33:48 +0300, Ville Vainio <[EMAIL PROTECTED]> wrote:
>> > "Jeremy" =3D=3D Jeremy Bowers <[EMAIL PROTECTED]> writes:
>>=20
>> Jeremy> On Sun, 24 Apr 2005 22:59:12 -0700, Robert Kern wrote:
>> >>
[EMAIL PROTECTED] (Bengt Richter) writes:
> On Mon, 25 Apr 2005 16:48:46 -0400, Bill Mill <[EMAIL PROTECTED]> wrote:
>>+1 . I think that we should still have the form [genexp] , but without
>>the dangling variable, and implemented with generator expressions. It
>>seems to me that it is inconsisten
"Mike Meyer" <[EMAIL PROTECTED]> wrote in message
> The question under these circumstances is then: do you want bare
> genexp to mean something? Right now, it's a syntax error. But there's
> no reason you couldn't have:
>
> y = x for x in stuff
>
> assign a generator object to y.
Since this was
Mike Meyer wrote:
> The question under these circumstances is then: do you want bare
> genexp to mean something? Right now, it's a syntax error. But there's
> no reason you couldn't have:
>
>y = x for x in stuff
I like
y = (x for x in stuff)
as it is, it's way more readable.
Reinhold
--
On Tue, 26 Apr 2005 02:12:07 -0500, Mike Meyer wrote:
> Right. But that shouldn't be hard to do. Let genexp stand for a a
> generator expression/list comprehension without any brackets on it at all.
> Then [genexp] is the syntax to expand the list. [(genexp)] is the syntax
> to create a list of one
On Tue, 26 Apr 2005 13:22:28 -0400, "Terry Reedy" <[EMAIL PROTECTED]> wrote:
>
>"Mike Meyer" <[EMAIL PROTECTED]> wrote in message
>> The question under these circumstances is then: do you want bare
>> genexp to mean something? Right now, it's a syntax error. But there's
>> no reason you couldn't h
24 matches
Mail list logo