Re: map is useless!

2010-06-07 Thread James Mills
On Mon, Jun 7, 2010 at 9:20 AM, Steven D'Aprano wrote: >> Ruby has a very nice map > > I'm thrilled for them. Personally I think the syntax is horrible. I concur! --James -- http://mail.python.org/mailman/listinfo/python-list

Re: map is useless!

2010-06-06 Thread Terry Reedy
On 6/6/2010 7:20 PM, Steven D'Aprano wrote: On Sun, 06 Jun 2010 08:16:02 -0700, rantingrick wrote: Everyone knows i'm a Python fanboy so nobody can call me a troll for this... The first rule of trolling is, always deny being a troll, no matter how obvious the trolling. Such as the exagerate

Re: map is useless!

2010-06-06 Thread Carl Banks
On Jun 6, 8:16 am, rantingrick wrote: > Everyone knows i'm a Python fanboy so nobody can call me a troll for > this... 1. I don't remember you so I don't know if you're a Python fanboy or not 2. If you act like a troll I'll call you one even if you are Python fanboy Actually, your post only came

Re: map is useless!

2010-06-06 Thread D'Arcy J.M. Cain
On Mon, 07 Jun 2010 10:16:19 +1000 Lie Ryan wrote: > On 06/07/10 09:56, D'Arcy J.M. Cain wrote: > > Show me the unit test that defines the problem. > > that you must use foo() and you can't change foo() (since foo is very > complex), and you give the same result as the original solution. I rejec

Re: map is useless!

2010-06-06 Thread Lie Ryan
On 06/07/10 09:56, D'Arcy J.M. Cain wrote: > On Mon, 07 Jun 2010 05:59:02 +1000 > Lie Ryan wrote: >>> foo = lambda x: [y + 1 for y in x] >>> [foo(x) for x in [[4, 6, 3], [6, 3, 2], [1, 3, 5]]] >>> >>> Didn't seem like such a long walk. >>> >> >> that's because you're simplifying the problem, the c

Re: map is useless!

2010-06-06 Thread D'Arcy J.M. Cain
On Mon, 07 Jun 2010 05:59:02 +1000 Lie Ryan wrote: > > foo = lambda x: [y + 1 for y in x] > > [foo(x) for x in [[4, 6, 3], [6, 3, 2], [1, 3, 5]]] > > > > Didn't seem like such a long walk. > > > > that's because you're simplifying the problem, the correct walk is: Well, since it gives the same

Re: map is useless!

2010-06-06 Thread Steven D'Aprano
On Sun, 06 Jun 2010 08:16:02 -0700, rantingrick wrote: > Everyone knows i'm a Python fanboy so nobody can call me a troll for > this... The first rule of trolling is, always deny being a troll, no matter how obvious the trolling. But on the chance I'm wrong, and for the benefit of others, your

Re: map is useless!

2010-06-06 Thread Terry Reedy
On 6/6/2010 11:16 AM, rantingrick wrote: Everyone knows i'm a Python fanboy so nobody can call me a troll for this... Non sequitor. It depends on your intention in posting this... Python map is just completely useless. For one it so damn slow Posting invalid speed comparisons stacked agains

Re: map is useless!

2010-06-06 Thread rantingrick
On Jun 6, 2:48 pm, Richard Thomas wrote: > Python's map has the useful feature that nobody is in any doubt about > what it does. I don't know much about Ruby I have to say but looking > at that piece of syntax you gave I had no idea how to interpret it. > Anyway, I looked it up. Well Ruby likes t

Re: map is useless!

2010-06-06 Thread Lie Ryan
On 06/07/10 05:54, D'Arcy J.M. Cain wrote: > On Mon, 07 Jun 2010 05:27:43 +1000 > Lie Ryan wrote: >> In the most naive uses, map appears to have no advantage over list >> comprehension; but one thing that map can do that list comprehension >> still can't do without a walk around the park: >> >> de

Re: map is useless!

2010-06-06 Thread D'Arcy J.M. Cain
On Mon, 07 Jun 2010 05:27:43 +1000 Lie Ryan wrote: > In the most naive uses, map appears to have no advantage over list > comprehension; but one thing that map can do that list comprehension > still can't do without a walk around the park: > > def foo(func, args): > g = lambda x: x+1 > re

Re: map is useless!

2010-06-06 Thread Richard Thomas
Python's map has the useful feature that nobody is in any doubt about what it does. I don't know much about Ruby I have to say but looking at that piece of syntax you gave I had no idea how to interpret it. Anyway, I looked it up. Calling an method on each of a collection of objects is best accomp

Re: map is useless!

2010-06-06 Thread Thomas Jollans
On 06/06/2010 05:16 PM, rantingrick wrote: > So can anyone explain this poor excuse for a map function? Maybe GVR > should have taken it out in 3.0? *scratches head* > > Speaking of Py3k: map no longer builds lists. What once was map is no more, what once was itertools.imap is now map. Sometim

Re: map is useless!

2010-06-06 Thread Lie Ryan
On 06/07/10 03:22, rantingrick wrote: > On Jun 6, 12:02 pm, Alain Ketterlin > wrote: >> rantingrick writes: >> I've not used map since I learned about list comprehensions. > > Thats has been my experienced also. Actually i've been at Python for > O... about 2 years now and i don't think i've eve

Re: map is useless!

2010-06-06 Thread rantingrick
On Jun 6, 12:02 pm, Alain Ketterlin wrote: > rantingrick writes: > I've not used map since I learned about list comprehensions. Thats has been my experienced also. Actually i've been at Python for O... about 2 years now and i don't think i've ever used map in a script even one time until a month

Re: map is useless!

2010-06-06 Thread Shashwat Anand
map is not needed. LC is great :D On Sun, Jun 6, 2010 at 10:32 PM, Alain Ketterlin < al...@dpt-info.u-strasbg.fr> wrote: > rantingrick writes: > > > Python map is just completely useless. [...] > > import time > def test1(): > > l = range(1) > > t1 = time.time() > >

Re: map is useless!

2010-06-06 Thread Alain Ketterlin
rantingrick writes: > Python map is just completely useless. [...] import time def test1(): > l = range(1) > t1 = time.time() > map(lambda x:x+1, l) > t2= time.time() > print t2-t1 def test2(): > l = range(1) > t1 = time.time() >

Re: map is useless!

2010-06-06 Thread Duncan Booth
rantingrick wrote: > Python map is just completely useless. For one it so damn slow why > even bother putting it in the language? And secondly, the total "girl- > man" weakness of lambda renders it completely mute! Do you realise that you don't have to use lambda? If you need more than a single

Re: map is useless!

2010-06-06 Thread Roald de Vries
On Jun 6, 2010, at 5:16 PM, rantingrick wrote: Everyone knows i'm a Python fanboy so nobody can call me a troll for this... Python map is just completely useless. For one it so damn slow why even bother putting it in the language? And secondly, the total "girl- man" weakness of lambda renders it

Re: map is useless!

2010-06-06 Thread James Mills
On Mon, Jun 7, 2010 at 1:16 AM, rantingrick wrote: > So can anyone explain this poor excuse for a map function? Maybe GVR > should have taken it out in 3.0?  *scratches head* Let me get this straight... You're complaining about some trivial code you've written and a 0.002 or less execution time ?

map is useless!

2010-06-06 Thread rantingrick
Everyone knows i'm a Python fanboy so nobody can call me a troll for this... Python map is just completely useless. For one it so damn slow why even bother putting it in the language? And secondly, the total "girl- man" weakness of lambda renders it completely mute! Ruby has a very nice map >>>