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)) > >> > >> Sadly, we can't remove list comprehensions until 3.0. > > Jeremy> Why "remove" them? Instead, we have these things called > Jeremy> "comprehensions" (which, now that I say that, seems a > Jeremy> rather odd name), and you can control whether they result > Jeremy> in a list or a generator with () or []. > > 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 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 inconsistent if I can do list(genexp) but not [genexp] , since they are so similar. Once that happens, we can tell people who ask the OP's question that [genexp] is just another way to spell list(genexp), and he should use it if he wants the entire list constructed in memory. > Jeremy> should be relatively simple), it's not worth breaking that > Jeremy> code. > > Well, the code that relies on the dangling variable deserves to break. Agreed. Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list