Re: map/filter/reduce/lambda opinions and background unscientificmini-survey

2005-07-03 Thread Steven D'Aprano
Carl Banks wrote: > The shamelessness with which you inflated the verbosity of the latter > is hilarious. [snip] > [ x**2 + y**2 for (x,y) in izip(xlist,ylist) ] > > Now there's no longer much advantage in conciseness for the map version > (seeing that you'd have

Re: map/filter/reduce/lambda opinions and background unscientific mini-survey

2005-07-03 Thread Ron Adam
Erik Max Francis wrote: > Ron Adam wrote: > >> Each item needs to stand on it's own. It's a much stronger argument >> for removing something because something else fulfills it's need and >> is easier or faster to use than just saying we need x because we have y. >> >> In this case sum and prod

Re: map/filter/reduce/lambda opinions and background unscientific mini-survey

2005-07-03 Thread Erik Max Francis
Ron Adam wrote: > Each item needs to stand on it's own. It's a much stronger argument for > removing something because something else fulfills it's need and is > easier or faster to use than just saying we need x because we have y. > > In this case sum and product fulfill 90% (estimate of cour

Re: map/filter/reduce/lambda opinions and background unscientific mini-survey

2005-07-03 Thread Ron Adam
either using reduce or a for-loop. I think the disagreements will be sorted out. >>2. Reduce calls a function on every item in the list, so it's >>performance isn't much better than the equivalent code using a for-loop. > > That is an optimization issue. Especially w

Re: map/filter/reduce/lambda opinions and background unscientific mini-survey

2005-07-03 Thread Erik Max Francis
Mike Meyer wrote: > I'd say that removing functions is a bad thing. On the other hand, I'd > say moving them from builtins to the standard library when Python has > functionality that covers most of the use cases for them is a good > thing. We all can pretty much guess

Re: map/filter/reduce/lambda opinions and background unscientific mini-survey

2005-07-03 Thread Mike Meyer
ng really wrong with that, but it's unappealing. I'd say that removing functions is a bad thing. On the other hand, I'd say moving them from builtins to the standard library when Python has functionality that covers most of the use cases for them is a good thing. The latter has occu

Re: map/filter/reduce/lambda opinions and background unscientificmini-survey

2005-07-03 Thread Erik Max Francis
Christopher Subich wrote: > Interesting; could you post an example of this? Whenever I try to think > of that, I come up with unwieldly syntax for the functional case. In > purely functional code the results of map/filter/etc would probably be > directly used as arguments to oth

Re: map/filter/reduce/lambda opinions and background unscientific mini-survey

2005-07-03 Thread Steven Bethard
Christopher Subich wrote: > One caevat that I just noticed, though -- with the for-solution, you do > need to be careful about whether you're using a generator or list if you > do not set an explicit initial value (and instead use the first value of > 'sequence' as the start). The difference is

Re: map/filter/reduce/lambda opinions and background unscientificmini-survey

2005-07-03 Thread Christopher Subich
Carl Banks wrote: > > Christopher Subich wrote: >>I've heard this said a couple times now -- how can listcomps not >>completely replace map and filter? > If you're doing heavy functional programming, listcomps are > tremendously unwieldy compared to map et a

Re: map/filter/reduce/lambda opinions and background unscientific mini-survey

2005-07-03 Thread Steven D'Aprano
rformance isn't much better than the equivalent code using a for-loop. That is an optimization issue. Especially when used with the operator module, reduce and map can be significantly faster than for loops. > *** (note, that list.sort() has the same problem. I would support > replac

Re: map/filter/reduce/lambda opinions and backgroundunscientificmini-survey

2005-07-03 Thread Scott David Daniels
Jp Calderone wrote: > Suggesting people can "like it or lump it" is a disservice to everyone. However, when people start with "why is this so" and rather than listen for information, try to argue that they are right, that behavior is a disservice to the group. Preparing a cogent argument to convi

Re: map/filter/reduce/lambda opinions and background unscientificmini-survey

2005-07-03 Thread Carl Banks
Christopher Subich wrote: > Carl Banks wrote: > > > Listcomps et al. cannot do everything map, lambda, filter, and reduce > > did. Listcomps are inferior for functional programming. But, you see, > > functional is not the point. Streamlining procedural programs is th

Re: map/filter/reduce/lambda opinions and background unscientificmini-survey

2005-07-03 Thread Carl Banks
Steven D'Aprano wrote: > On Sun, 03 Jul 2005 08:14:28 -0700, Scott David Daniels wrote: > > > egbert wrote: > >> On Sat, Jul 02, 2005 at 08:26:31PM -0700, Devan L wrote: > >> > >>>Also, map is easily replaced. > >>>map(f1, sequence) ==

Re: map/filter/reduce/lambda opinions and background unscientific mini-survey

2005-07-03 Thread Ron Adam
Erik Max Francis wrote: > Ron Adam wrote: >> I'm just estimating, but I think that is the gist of adding those two >> in exchange for reduce. Not that they will replace all of reduce use >> cases, but that sum and product cover most situations and can be >> implemented more efficiently than u

Re: map/filter/reduce/lambda opinions and background unscientificmini-survey

2005-07-03 Thread Jp Calderone
ing them to use them. Python is being pushed into directions which >> are *far* harder to understand than map and reduce (currying, decorators, >> etc) and people don't complain about those. > >I find it surreal too, for a different reason. > >Python *works*, right n

Re: map/filter/reduce/lambda opinions and background unscientificmini-survey

2005-07-03 Thread Peter Hansen
Steven D'Aprano wrote: > Frankly, I find this entire discussion very surreal. Reduce etc *work*, > right now. They have worked for years. If people don't like them, nobody > is forcing them to use them. Python is being pushed into directions which > are *far* harder to u

Re: map/filter/reduce/lambda opinions and background unscientificmini-survey

2005-07-03 Thread Christopher Subich
Scott David Daniels wrote: > egbert wrote: >> How do you replace >> map(f1,sequence1, sequence2) >> especially if the sequences are of unequal length ? >> >> I didn't see it mentioned yet as a candidate for limbo, >> but the same question goes for: >&

Re: map/filter/reduce/lambda opinions and background unscientificmini-survey

2005-07-03 Thread Christopher Subich
Carl Banks wrote: > Listcomps et al. cannot do everything map, lambda, filter, and reduce > did. Listcomps are inferior for functional programming. But, you see, > functional is not the point. Streamlining procedural programs is the > point, and I'd say listcomps do tha

Re: map/filter/reduce/lambda opinions and background unscientificmini-survey

2005-07-03 Thread Steven D'Aprano
On Sun, 03 Jul 2005 08:14:28 -0700, Scott David Daniels wrote: > egbert wrote: >> On Sat, Jul 02, 2005 at 08:26:31PM -0700, Devan L wrote: >> >>>Also, map is easily replaced. >>>map(f1, sequence) == [f1(element) for element in sequence] >> >> How

Re: map/filter/reduce/lambda opinions and background unscientificmini-survey

2005-07-03 Thread Scott David Daniels
egbert wrote: > On Sat, Jul 02, 2005 at 08:26:31PM -0700, Devan L wrote: > >>Also, map is easily replaced. >>map(f1, sequence) == [f1(element) for element in sequence] > > How do you replace > map(f1,sequence1, sequence2) > especially if the sequences are of unequal

Re: map/filter/reduce/lambda opinions and background unscientificmini-survey

2005-07-03 Thread Carl Banks
John Roth wrote: > "Robert Kern" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > > > > map and filter are being removed *because of* list comprehensions. Did you > > even read Guido's articles about this issue? Your understanding o

Re: map/filter/reduce/lambda opinions and background unscientific mini-survey

2005-07-03 Thread egbert
On Sat, Jul 02, 2005 at 08:26:31PM -0700, Devan L wrote: > > Also, map is easily replaced. > map(f1, sequence) == [f1(element) for element in sequence] > How do you replace map(f1,sequence1, sequence2) especially if the sequences are of unequal length ? I didn't see it m

Re: map/filter/reduce/lambda opinions and background unscientific mini-survey

2005-07-02 Thread Erik Max Francis
t in? I'm not myself a huge functional programming guy, but I'm certainly not in favor of the proposal to remove map, filter, reduce, and lambda. For map and filter, I can at least see the argument, because they truly are expressible with list comprehensions (which I do use myself, o

Re: map/filter/reduce/lambda opinions and background unscientific mini-survey

2005-07-02 Thread Ron Adam
Steven D'Aprano wrote: > On Sat, 02 Jul 2005 20:26:31 -0700, Devan L wrote: > > >> Claiming that sum etc. do the same job is the whimper of >>someone who doesn't want to openly disagree with Guido. >> >>Could you give an example where sum cannot do the job(besides the >>previously mentioned prod

Re: map/filter/reduce/lambda opinions and background unscientific mini-survey

2005-07-02 Thread Jp Calderone
On Sun, 03 Jul 2005 01:01:18 -0400, Christopher Subich <[EMAIL PROTECTED]> wrote: >Steven D'Aprano wrote: >> comps. But reduce can't be written as a list comp, only as a relatively >> complex for loop at a HUGE loss of readability -- and I've never used >> Lisp or Scheme in my life. I'm surely not

Re: map/filter/reduce/lambda opinions and background unscientific mini-survey

2005-07-02 Thread Christopher Subich
Steven D'Aprano wrote: > comps. But reduce can't be written as a list comp, only as a relatively > complex for loop at a HUGE loss of readability -- and I've never used > Lisp or Scheme in my life. I'm surely not the only one. See my reply to your other post for a more detailed explanation, but I

Re: map/filter/reduce/lambda opinions and background unscientific mini-survey

2005-07-02 Thread Steven D'Aprano
of reduce. > Also, map is easily replaced. > map(f1, sequence) == [f1(element) for element in sequence] Three mental tokens ( map, f1, sequence ) versus seven ( [], f1, element, for, element, in, sequence ). Also, map can take any number of sequences: map(f1, seq1, seq2, seq3, seq4, ...

Re: map/filter/reduce/lambda opinions and background unscientific mini-survey

2005-07-02 Thread Peter Hansen
Steven D'Aprano wrote: > On Fri, 01 Jul 2005 13:42:10 -0400, Mike Meyer wrote: >>No, he wants Python to be Pythonic. TMTOWTDI is not Pythonic. > > Too Many T--- Only Way To Do It? > > There Might Tangle One Way To Do It? > > T--- M--- Two Obvious Ways To Do It? > > Nope, sorry, still not gettin

Re: map/filter/reduce/lambda opinions and background unscientific mini-survey

2005-07-02 Thread Devan L
Claiming that sum etc. do the same job is the whimper of someone who doesn't want to openly disagree with Guido. Could you give an example where sum cannot do the job(besides the previously mentioned product situation? Also, map is easily replaced. map(f1, sequence) == [f1(element) for el

Re: map/filter/reduce/lambda opinions and background unscientific mini-survey

2005-07-02 Thread Steven D'Aprano
On Fri, 01 Jul 2005 19:15:46 -0700, Erik Max Francis wrote: > Sean McIlroy wrote: > >> if that's the case then list >> comprehensions and/or "first class functions" are likely to be the next >> target. > > Slippery slope arguments are logical fallacies, you know. Not if you are actually standin

Re: map/filter/reduce/lambda opinions and background unscientific mini-survey

2005-07-02 Thread Steven D'Aprano
ython bother introducing list comps when there is nothing they can do that a for loop can't? Functional programming using map etc does require a slightly different way of thinking about programming than does procedural programming, just as object-oriented needs a different way of thinking than spag

Re: map/filter/reduce/lambda opinions and background unscientific mini-survey

2005-07-02 Thread Steven D'Aprano
On Fri, 01 Jul 2005 09:13:58 -0700, mcherm wrote: > Lambda serves a very specific purpose: declaring small, in-place > functions which are no bigger than a single expression. I do this often > enough that I DO want special syntax for it. But I'll admit that I > wish "lambda" were about 5 or 6 cha

Re: map/filter/reduce/lambda opinions and background unscientific mini-survey

2005-07-02 Thread Mike Meyer
Jamey Cribbs <[EMAIL PROTECTED]> writes: > Code blocks allow you to wrap up any Ruby code and pass it to a method > and have it executed within that method. It is more powerful than > lambda, because you can have multiple statements in the code block and > you can do assignment within the code blo

Re: map/filter/reduce/lambda opinions and background unscientific mini-survey

2005-07-02 Thread Jamey Cribbs
Tom Anderson wrote: > So, if you're a pythonista who loves map and lambda, and disagrees with > Guido, what's your background? Functional or not? I have no functional language background. Until recently, I had no use for programming "expression to be evaluated later"

Re: map/filter/reduce/lambda opinions and background unscientificmini-survey

2005-07-02 Thread Robert Kern
John Roth wrote: > "Robert Kern" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >>map and filter are being removed *because of* list comprehensions. Did you >>even read Guido's articles about this issue? Your understanding of why

Re: map vs. list-comprehension

2005-07-02 Thread Tom Anderson
On Fri, 1 Jul 2005, Sion Arrowsmith wrote: > Tom Anderson <[EMAIL PROTECTED]> wrote: >> On Thu, 30 Jun 2005, Roy Smith wrote: >> >>> Even some of the relatively recent library enhancements have been kind >>> of complicated. The logging module, for example, seems way over the >>> top. >> >> Exa

Re: map/filter/reduce/lambda opinions and background unscientificmini-survey

2005-07-02 Thread Tom Anderson
On Fri, 1 Jul 2005, Ivan Van Laningham wrote: > Personally, I find that Lisp & its derivatives put your head in a very > weird place. Even weirder than PostScript/Forth/RPN, when you come > right down to it. +1 QOTW! tom -- REMOVE AND DESTROY -- http://mail.python.org/mailman/listinfo/pyth

Re: map/filter/reduce/lambda opinions and background unscientificmini-survey

2005-07-02 Thread John Roth
"Robert Kern" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > map and filter are being removed *because of* list comprehensions. Did you > even read Guido's articles about this issue? Your understanding of why > these changes are planne

Re: map/filter/reduce/lambda opinions and background unscientific mini-survey

2005-07-01 Thread Donn Cave
Quoth Tom Anderson <[EMAIL PROTECTED]>: ... | I disagree strongly with Guido's proposals, and i am not an ex-Lisp, | -Scheme or -any-other-functional-language programmer; my only other real | language is Java. I wonder if i'm an outlier. | | So, if you're a pythonista who

Re: map/filter/reduce/lambda opinions and background unscientific mini-survey

2005-07-01 Thread Ron Adam
Terry Hancock wrote: > On Friday 01 July 2005 03:36 pm, Ron Adam wrote: > >>I find map too limiting, so won't miss it. I'm +0 on removing lambda >>only because I'm unsure that there's always a better alternative. > > > Seems like some new

Re: map/filter/reduce/lambda opinions and background unscientific mini-survey

2005-07-01 Thread Mike Meyer
"Sean McIlroy" <[EMAIL PROTECTED]> writes: > Peter Hansen wrote: > >> Sean, what gave you the impression this would change? > if that's the case then list comprehensions and/or "first class > functions" are likely to be the next target. The existence of list comprehensions are the reason that th

Re: map/filter/reduce/lambda opinions and background unscientific mini-survey

2005-07-01 Thread Robert Kern
ammers, baffled by > recursion and the like, who don't want to be reproached with the fact > of their mathematical illiteracy.) if that's the case then list > comprehensions and/or "first class functions" are likely to be the next > target. map and filter are being re

Re: map/filter/reduce/lambda opinions and background unscientific mini-survey

2005-07-01 Thread Robert Kern
syntaxes can still be managed? > IOW, just ripping them out of the core and leaving everyone in the > lurch doesn't seem too pythonic to me. Python 3000 will be breaking more backwards compatibility than map/reduce/filter. That legacy code won't work anyways. I predict, though, that

Re: map/filter/reduce/lambda opinions and background unscientific mini-survey

2005-07-01 Thread Erik Max Francis
Sean McIlroy wrote: > if that's the case then list > comprehensions and/or "first class functions" are likely to be the next > target. Slippery slope arguments are logical fallacies, you know. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N 1

Re: map/filter/reduce/lambda opinions and background unscientific mini-survey

2005-07-01 Thread Chris Smith
>>>>> "Devan" == Devan L <[EMAIL PROTECTED]> writes: Devan> None of them are really indispensible. Map and filter cab Devan> be replaced with list comprehensions. reduce is redundant Devan> except when multiplying a series; there's a sum f

Re: map/filter/reduce/lambda opinions and background unscientific mini-survey

2005-07-01 Thread Sean McIlroy
Peter Hansen wrote: > Sean, what gave you the impression this would change? just inductive reasoning. i've been wrong before (like anyone who makes that claim), and i'm a former python enthusiast, so my judgement must be colored to some extent by bitterness. maybe they have solid reasons for scr

Re: map/filter/reduce/lambda opinions and background unscientific mini-survey

2005-07-01 Thread Paul McGuire
I have never written a line of Lisp or Scheme, so it took me a while to grok "lambda" as a synonym for "expression to be evaluated later". I then thought it was similar to Smalltalk's functional closures, since you can define local arguments at the beginning of the block, and then write the body o

Re: map/filter/reduce/lambda opinions and background unscientific mini-survey

2005-07-01 Thread Peter Hansen
Sean McIlroy wrote: > personally i don't know lisp (or scheme), but now i've > decided to learn it, because eventually it will no longer be possible > in python to pass functions as arguments or return them as values. the > education sig will have to change its motto to "computer programming > for

Re: map/filter/reduce/lambda opinions and background unscientific mini-survey

2005-07-01 Thread John Roth
wpost.jsp?thread=98196 > > He says he's going to dispose of map, filter, reduce and lambda. He's > going to give us product, any and all, though, which is nice of him. > > What really struck me, though, is the last line of the abstract: > > "I expect tons of di

Re: map/filter/reduce/lambda opinions and background unscientific mini-survey

2005-07-01 Thread Sean McIlroy
Tom Anderson wrote: > So, if you're a pythonista who loves map and lambda, and disagrees with > Guido, what's your background? Functional or not? glad you asked. personally i don't know lisp (or scheme), but now i've decided to learn it, because eventually it wil

Re: map/filter/reduce/lambda opinions and background unscientific mini-survey

2005-07-01 Thread Terry Hancock
On Friday 01 July 2005 03:36 pm, Ron Adam wrote: > I find map too limiting, so won't miss it. I'm +0 on removing lambda > only because I'm unsure that there's always a better alternative. Seems like some new idioms would have to be coined, like: def my_function(a1, a

Re: map/filter/reduce/lambda opinions and background unscientific mini-survey

2005-07-01 Thread Jp Calderone
On Fri, 01 Jul 2005 20:36:29 GMT, Ron Adam <[EMAIL PROTECTED]> wrote: >Tom Anderson wrote: > >> So, if you're a pythonista who loves map and lambda, and disagrees with >> Guido, what's your background? Functional or not? > >I find map too limiting, so w

Re: map/filter/reduce/lambda opinions and background unscientific mini-survey

2005-07-01 Thread Ron Adam
Tom Anderson wrote: > So, if you're a pythonista who loves map and lambda, and disagrees with > Guido, what's your background? Functional or not? I find map too limiting, so won't miss it. I'm +0 on removing lambda only because I'm unsure that there's a

Re: map/filter/reduce/lambda opinions and background unscientific mini-survey

2005-07-01 Thread Erik Max Francis
Tom Anderson wrote: > So, if you're a pythonista who loves map and lambda, and disagrees with > Guido, what's your background? Functional or not? I'm familiar with several function languages but haven't used them extensively; I was primarily a C++ programmer

Re: map vs. list-comprehension

2005-07-01 Thread Roy Smith
Scott David Daniels <[EMAIL PROTECTED]> wrote: >Roy Smith wrote: >> Look at what happened to C when it mutated into C++. In isolation, most of >> the features of C++ seem like good ideas. Taken together, it's a huge >> hairy mess that most people only understand increasingly larger subsets of.

Re: map vs. list-comprehension

2005-07-01 Thread Scott David Daniels
Roy Smith wrote: > Look at what happened to C when it mutated into C++. In isolation, most of > the features of C++ seem like good ideas. Taken together, it's a huge > hairy mess that most people only understand increasingly larger subsets of. > Fred Brooks called it the second system syndrom

Re: map vs. list-comprehension

2005-07-01 Thread Stelios Xanthakis
Mandus wrote: > jepp - faster, but still slower than the map. > > 100 iterations: > zip+list-comprehension: 8.1s > izip+list-comprehension: 7.5s > map: 7.0s > Strange. On 2.4.1 izip is the fastest. The thing is that if you put benchmark code in global the results

Re: map/filter/reduce/lambda opinions and background unscientific mini-survey

2005-07-01 Thread Mike Meyer
"iK" <[EMAIL PROTECTED]> writes: > Seems like he wants python programmers to solve their problems all in the > same way. While that is great for corporate slaves it is terrible for the > creative programmer. No, he wants Python to be Pythonic. TMTOWTDI is not Pythonic. > Python is quickly beco

Re: map/filter/reduce/lambda opinions and background unscientific mini-survey

2005-07-01 Thread Steven Bethard
[EMAIL PROTECTED] wrote: > I avoid map sometimes, because I find its syntax less readable > than list (and expression) comprehensions. But occasionally it > is the most readable way to do something, and I wouldn't want to lose > it. I tend to avoid map as much as possible. Th

Re: map/filter/reduce/lambda opinions and background unscientific mini-survey

2005-07-01 Thread Devan L
None of them are really indispensible. Map and filter cab be replaced with list comprehensions. reduce is redundant except when multiplying a series; there's a sum function for a reason. Lambda looks cleaner in some cases, but you don't gain any functionality. What really struck me,

Re: map/filter/reduce/lambda opinions and background unscientific mini-survey

2005-07-01 Thread mcherm
Tom Anderson wrote: > So, if you're a pythonista who loves map and lambda, and disagrees with > Guido, what's your background? Functional or not? I avoid map sometimes, because I find its syntax less readable than list (and expression) comprehensions. But occasionally it is the m

Re: map/filter/reduce/lambda opinions and background unscientific mini-survey

2005-07-01 Thread George Sakkis
> Seems like he wants python programmers to solve their problems all in the > same way. While that is great for corporate slaves it is terrible for the > creative programmer. > Python is quickly becoming the visual basic of the 21 century. If you want > to have fun while getting some work done you

Re: map/filter/reduce/lambda opinions and background unscientific mini-survey

2005-07-01 Thread iK
Seems like he wants python programmers to solve their problems all in the same way. While that is great for corporate slaves it is terrible for the creative programmer. Python is quickly becoming the visual basic of the 21 century. If you want to have fun while getting some work done you need to

Re: map/filter/reduce/lambda opinions and background

2005-07-01 Thread François Pinard
er-functional-language programmer; my only other > > real language is Java. I wonder if i'm an outlier. > > So, if you're a pythonista who loves map and lambda, and disagrees > > with Guido, what's your background? Functional or not? > I'm a pythonista who doesn&

Re: map vs. list-comprehension

2005-07-01 Thread Sion Arrowsmith
Tom Anderson <[EMAIL PROTECTED]> wrote: >On Thu, 30 Jun 2005, Roy Smith wrote: >> Even some of the relatively recent library enhancements have been kind >> of complicated. The logging module, for example, seems way over the >> top. >Exactly the same thing happened with Java. I was under the im

Re: map vs. list-comprehension

2005-07-01 Thread George Sakkis
"Tom Anderson" wrote: > On Fri, 1 Jul 2005, George Sakkis wrote: > > > Keeping the language small is a worthwhile goal, but it should be traded > > off with conciseness and readability; otherwise we could well be content > > with s-expressions. > > There's quite a number of satisfied LISP programm

Re: map/filter/reduce/lambda opinions and background unscientificmini-survey

2005-07-01 Thread Ivan Van Laningham
ogrammer; my only other real > language is Java. I wonder if i'm an outlier. > > So, if you're a pythonista who loves map and lambda, and disagrees with > Guido, what's your background? Functional or not? > I'm a pythonista who doesn't love them. In fa

map/filter/reduce/lambda opinions and background unscientific mini-survey

2005-07-01 Thread Tom Anderson
Comrades, During our current discussion of the fate of functional constructs in python, someone brought up Guido's bull on the matter: http://www.artima.com/weblogs/viewpost.jsp?thread=98196 He says he's going to dispose of map, filter, reduce and lambda. He's going to give

Re: map vs. list-comprehension

2005-07-01 Thread Tom Anderson
On Fri, 1 Jul 2005, George Sakkis wrote: > "Terry Hancock" wrote: > > Keeping the language small is a worthwhile goal, but it should be traded > off with conciseness and readability; otherwise we could well be content > with s-expressions. There's quite a number of satisfied LISP programmers ou

Re: map vs. list-comprehension

2005-07-01 Thread Tom Anderson
On Thu, 30 Jun 2005, Roy Smith wrote: > Terry Hancock <[EMAIL PROTECTED]> wrote: > >> One of the strengths of Python has been that the language itself is >> small (which it shares with C and (if I understand correctly, not being >> a lisp programmer?) Lisp), but with all the syntax enhancements

Re: map vs. list-comprehension

2005-07-01 Thread George Sakkis
"Terry Hancock" wrote: > On Thursday 30 June 2005 09:49 am, Mike P. wrote: > > > IMHO I'm not particularly happy with the way Python is going language wise. > > I mean, I don't think I'll ever use decorators, for example. Personally, in > > terms of language features and capabilities I think the l

Re: map vs. list-comprehension

2005-06-30 Thread Roy Smith
Robert Kern <[EMAIL PROTECTED]> wrote: > Looks like the PSU got to yoNO CARRIER No, the trackpad on my PowerBook seems to have gone a little haywire and I'm getting the occasional random mouse click. In that case, it seemed to have clicked the "Post" button. -- http://mail.python.org/mailman/

Re: map vs. list-comprehension

2005-06-30 Thread Roy Smith
Terry Hancock <[EMAIL PROTECTED]> wrote: > One of the strengths of Python has been that the language itself is > small (which it shares with C and (if I understand correctly, not being > a lisp programmer?) Lisp), but with all the syntax enhancements going > on, Python is getting pretty complica

Re: map vs. list-comprehension

2005-06-30 Thread Robert Kern
Roy Smith wrote: > Terry Hancock <[EMAIL PROTECTED]> wrote: > >>One of the strengths of Python has been that the language itself is >>small (which it shares with C and (if I understand correctly, not being >>a lisp programmer?) Lisp), but with all the syntax enhancements going >>on, Python is g

Re: map vs. list-comprehension

2005-06-30 Thread Roy Smith
Terry Hancock <[EMAIL PROTECTED]> wrote: > One of the strengths of Python has been that the language itself is > small (which it shares with C and (if I understand correctly, not being > a lisp programmer?) Lisp), but with all the syntax enhancements going > on, Python is getting pretty complica

Re: map vs. list-comprehension

2005-06-30 Thread Terry Hancock
On Thursday 30 June 2005 09:49 am, Mike P. wrote: > That really sucks, I wasn't aware of these plans. Ok, I don't use reduce > much, but I use lambda, map and filter all the time. > [...] > Also, I don't necessarily think list comprehensions are necessarily easier >

Re: map vs. list-comprehension

2005-06-30 Thread Tom Anderson
uggested that. The ones that are planned to be removed are lambda, reduce, filter and map. Here's GvR's blog posting that explains the reasons: http://www.artima.com/weblogs/viewpost.jsp?thread=98196 That really sucks, I wasn't aware of these plans. Ok, I don't use reduce much,

Re: map vs. list-comprehension

2005-06-30 Thread Mike P.
as suggested that. The ones that are planned to be removed are > lambda, reduce, filter and map. Here's GvR's blog posting that explains > the reasons: > > http://www.artima.com/weblogs/viewpost.jsp?thread=98196 > That really sucks, I wasn't aware of these plans. Ok, I

Re: map vs. list-comprehension

2005-06-30 Thread Mandus
Wed, 29 Jun 2005 08:33:58 -0700 skrev Scott David Daniels: > Mandus wrote: >> 29 Jun 2005 10:04:40 GMT skrev F. Petitjean: >> >>>Le Wed, 29 Jun 2005 09:46:15 + (UTC), Mandus a écrit : >>> >>>res = [ bb+ii*dd for bb,ii,dd in zip(b,i,d) ] >> >

Re: map vs. list-comprehension

2005-06-29 Thread Terry Reedy
"F. Petitjean" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >res = [ bb+ii*dd for bb,ii,dd in zip(b,i,d) ] > Hoping that zip will not be deprecated. Cease worrying. Zip was added to replace the zipping behavior of map and the idiom map(None, a, b, ..

Re: map vs. list-comprehension

2005-06-29 Thread Scott David Daniels
Mandus wrote: > 29 Jun 2005 10:04:40 GMT skrev F. Petitjean: > >>Le Wed, 29 Jun 2005 09:46:15 + (UTC), Mandus a écrit : >> >>res = [ bb+ii*dd for bb,ii,dd in zip(b,i,d) ] > > seem to be a tad slower than the map, but nothing serious. Guess it's > the ex

Re: map vs. list-comprehension

2005-06-29 Thread George Sakkis
"Carl Banks" <[EMAIL PROTECTED]> wrote in message > Fear not, people: just as the BDFL does not indiscriminately add > features, also he does not indiscriminately remove them. zip, though > it feels a little exotic, is very useful and serves a purpose that no > language feature serves(*), so rest

Re: map vs. list-comprehension

2005-06-29 Thread Carl Banks
F. Petitjean wrote: > Le Wed, 29 Jun 2005 09:46:15 + (UTC), Mandus a écrit : > > Hi there, > > > > inspired by a recent thread where the end of reduce/map/lambda in Python was > > discussed, I looked over some of my maps, and tried to convert them to > > list-c

Re: map vs. list-comprehension

2005-06-29 Thread Mandus
29 Jun 2005 10:04:40 GMT skrev F. Petitjean: > Le Wed, 29 Jun 2005 09:46:15 + (UTC), Mandus a écrit : >> Hi there, >> >> inspired by a recent thread where the end of reduce/map/lambda in Python was >> discussed, I looked over some of my maps, and tried to convert the

Re: map vs. list-comprehension

2005-06-29 Thread Björn Lindström
"F. Petitjean" <[EMAIL PROTECTED]> writes: > res = [ bb+ii*dd for bb,ii,dd in zip(b,i,d) ] > > Hoping that zip will not be deprecated. Nobody has suggested that. The ones that are planned to be removed are lambda, reduce, filter and map. Here's GvR's blog posti

Re: map vs. list-comprehension

2005-06-29 Thread F. Petitjean
Le Wed, 29 Jun 2005 09:46:15 + (UTC), Mandus a écrit : > Hi there, > > inspired by a recent thread where the end of reduce/map/lambda in Python was > discussed, I looked over some of my maps, and tried to convert them to > list-comprehensions. > > This one I am n

map vs. list-comprehension

2005-06-29 Thread Mandus
Hi there, inspired by a recent thread where the end of reduce/map/lambda in Python was discussed, I looked over some of my maps, and tried to convert them to list-comprehensions. This one I am not sure how to conver: Given three tuples of length n, b,i and d, I now do: map(lambda bb,ii,dd: bb

Re: __iadd__ and __isub__ map to += and -= but don't return result

2005-04-08 Thread Anthra Norell
I see! It's the in-place aspect that led me to assume that the assignment to self inside the method would do the trick. Next the explicit call reinforced the perception. Anyway, thank you very much for the clarification. Frederic   > Anthra Norell wrote:> >> If I am missing a point here, wha

Re: __iadd__ and __isub__ map to += and -= but don't return result

2005-04-08 Thread Fredrik Lundh
Anthra Norell wrote: > If I am missing a point here, what could it be? the documentation? > class Vertex (list): >def __init__ (self, *coordinates): self [:] = list (coordinates [0:2]) >def __add__ (self, V): return Vertex (self [X] + V [X], self [Y] + V [Y]) >def __iadd__ (self, V)

__iadd__ and __isub__ map to += and -= but don't return result

2005-04-08 Thread Anthra Norell
Hi!   If I am missing a point here, what could it be? Watch the hot spots (***)   Frederic     #     # Python 2.4, Windows ME  X = 0, Y = 1    class Vertex (list):    def __init__ (self, *coordinates): self [:] = l

Re: Python modules for image / map manipulation?

2005-04-06 Thread [EMAIL PROTECTED]
my image file is only about 5 MB, so, it's not too large. I've done some testing with PIL and it will meet my needs, I think. I can see how I could slice and dice my image, or only present the cropped section that I need. thanks, S -- http://mail.python.org/mailman/listinfo/python-list

Re: Python modules for image / map manipulation?

2005-04-04 Thread Robert Kern
Robert Kern wrote: I use PROJ.4 via pipes for cartographic projections. http://proj.maptools.org/ There is an addon to the matplotlib plotting library that contains a binding for the PROJ.4 library, but I haven't gotten it to work on my Mac. http://matplotlib.sourceforge.net/toolkits.html Jus

Re: Python modules for image / map manipulation?

2005-04-04 Thread Robert Kern
Stewart Midwinter wrote: I would like to do some image / map manipulation with Python. I've got a very large map file in .png format. My thought is to chop it up into small tiles using some method. What Python module would be helpful for this? The PIL. I'm not sure how well it handle

Python modules for image / map manipulation?

2005-04-04 Thread Stewart Midwinter
I would like to do some image / map manipulation with Python. I've got a very large map file in .png format. My thought is to chop it up into small tiles using some method. What Python module would be helpful for this? Next, when I obtain the start and end co-ordinates of a user's

Re: list-comprehension and map question (simple)

2005-03-30 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, runsun pan <[EMAIL PROTECTED]> wrote: . . . >Secondly, [x+y for x,y in itertools.izip(xs, ys)] did go much faster >than map(lambda x,y: x+y, xs, ys). The latter is not only the

Re: list-comprehension and map question (simple)

2005-03-30 Thread runsun pan
Thx, Robert. I did some tests: >>> xs = range(1) >>> ys = range(0,2,2) >>> def m1(x, count=100): ... for c in range(count): ...y = map(float, x) ... return y >>> def L1(x, count=100): ... for c in range(count): ...y = [f

Re: list-comprehension and map question (simple)

2005-03-28 Thread Robert Kern
runsun pan wrote: I remember reading somewhere that the map, filter, reduce are much faster than list comp. It depends. map(float, some_list_of_numbers) is going to be faster than [float(x) for x in some_list_of_numbers] but map(lambda x,y: x+y, xs, ys) is going to be slower than import

Re: list-comprehension and map question (simple)

2005-03-28 Thread runsun pan
I remember reading somewhere that the map, filter, reduce are much faster than list comp. -- http://mail.python.org/mailman/listinfo/python-list

Re: list-comprehension and map question (simple)

2005-03-27 Thread Charles Hartman
I very much take your point. And thanks: that answers my syntax question (I think!) -- *and* tells me that I don't care. Charles Hartman On Mar 27, 2005, at 2:16 PM, [EMAIL PROTECTED] wrote: ... >>> simpler == complexities True >>> I've not the glimmer of a clue which would be faster, and don't c

Re: list-comprehension and map question (simple)

2005-03-27 Thread Brian van den Broek
tion(len(x)) for x in lines.split()] [5, 5, 11, 11, 5, 11, 5, 11] >>> I could be missing some edge cases, but it seems to me that if you have list comps you don't really need map, filter, and the like. The map portion can be done by nested function applications in the list comp itse

<    3   4   5   6   7   8   9   >