I was responding to the complaint about map going away.
Idiomatic python for what the original poster is doing would be more like
import csv reader=csv.reader(open("file.csv")) # header=reader.next() for row in reader: # row is a list of strings from the columns in the csv file. # convert to int row=[int(c) for c in row]
If you're comfortable with your language, there's no need to address my comment. My post was competitive - coming from the viewpoint that it is possible for some languages to better or worse than others - and furthermore, that it's worth the effort to compare them and select the best.
Things like "better", "worse" and "best" are subjective. We don't want them to be, but they are. You are demonstrating a strong preference for consistency, something which is good, but not something that it is good to be a slave to. There is at least a case to be made for the special syntax, as it marks that the intent is to return an integer representation of the class, rather than just the length of the class (which may be better provided by an attribute or property, or even a length method).
It would enhance your complaint if you whined about the arbitrary best practice of inheriting from object when declaring a class.
I'm pretty okay chalking it up to differences in taste.
I know python and I don't know ruby, so it doesn't mean very much that I can't read what you wrote without going cross eyed, but I'm pretty sure that I prefer int(x) to word.to_i, global function or not. I mean, what a penalty, I can't use 'int' as an identifier.
That's a relatively superficial issue to take up. The part that I find powerful about that code is the composition of the built in data objects to solve the problems in a straightforward way.
Are you talking about the section 10 labeled "Python Pre-2.1 did not have lexical scopes."?
If so, your criticism is bizarre, the example is written to illustrate that "Python Pre-2.1 did not have lexical scopes.", not to illustrate the shortest way to rewrite the built-in sum function (you realize that right, that the idiomatic implementation of sum in python is the built in function?).
The reason map and reduce aren't cared about is that most people have an easier time with list comprehensions. Your code:
l = l.strip().split(',')
l = map(lambda x: int(x.strip(), l)
can be written as:
l = [int(x.strip()) for x in l.strip().split(',')]
in python 2.4 onwards. Obviously, you could put that on as many lines as you wanted. If you are worried about performance, generator expressions are very similar to list expressions but lazily evaluated:
g = (int(x.strip()) for x in l)
g would then create items as they are called for by some consumer (for instance, a for loop or a container object).
From what I can tell, the python community is not particularly obsessed with quoting monty python. More than 0, but much less than all the time. So maybe only hold that against the language a little bit.
No doubt these would be faster in C, but I don't think they would be particularly clearer:
I don't think I was trying to argue that the model M was slow, more that typing speed isn't something a whole lot of folks run into on a regular basis.
It's nice that you think they are plenty fast though.
Manufacturing is alive and well in the United States. The job growth from manufacturing isn't particularly strong though, as there is tons of automation. One guy running a couple of CNC lathes is more productive than 4 guys running manual lathes, and so on. Or something like Hyundai, where the spend less per vehicle on welding, but have higher consistency, because they are fully automated.
Fair enough. I really hope that movies are eventually downloadable for restricted playback though, at much lower cost. I would love to be able to rent a movie for $1 and watch it for 72 hours or so. At that price, I don't care about being able to resell it or if I own it or whatever.
Oh, I realize that it varies a great deal from person to person, but I don't think that you are anywhere near the mean, or the median. To some extent, I expect that I use a good deal more space than your average computer user, and certainly more than the average person.
What about the Microsoft shills and Apple fanboys?
Also, I think one guy uses BSD.
What if they charged them with cyber-murder?
They need to face consequences, but they need to face appropriate consequences.
It's not something I ever enjoyed.
David Lee Roth.
You have strange ideas about porn. Or a Sanjaya obsession.
Things like "better", "worse" and "best" are subjective. We don't want them to be, but they are. You are demonstrating a strong preference for consistency, something which is good, but not something that it is good to be a slave to. There is at least a case to be made for the special syntax, as it marks that the intent is to return an integer representation of the class, rather than just the length of the class (which may be better provided by an attribute or property, or even a length method).
It would enhance your complaint if you whined about the arbitrary best practice of inheriting from object when declaring a class.
I'm pretty okay chalking it up to differences in taste.
I know python and I don't know ruby, so it doesn't mean very much that I can't read what you wrote without going cross eyed, but I'm pretty sure that I prefer int(x) to word.to_i, global function or not. I mean, what a penalty, I can't use 'int' as an identifier.
That's a relatively superficial issue to take up. The part that I find powerful about that code is the composition of the built in data objects to solve the problems in a straightforward way.
Are you talking about the section 10 labeled "Python Pre-2.1 did not have lexical scopes."?
If so, your criticism is bizarre, the example is written to illustrate that "Python Pre-2.1 did not have lexical scopes.", not to illustrate the shortest way to rewrite the built-in sum function (you realize that right, that the idiomatic implementation of sum in python is the built in function?).
The reason map and reduce aren't cared about is that most people have an easier time with list comprehensions. Your code:
l = l.strip().split(',')
l = map(lambda x: int(x.strip(), l)
can be written as:
l = [int(x.strip()) for x in l.strip().split(',')]
in python 2.4 onwards. Obviously, you could put that on as many lines as you wanted. If you are worried about performance, generator expressions are very similar to list expressions but lazily evaluated:
g = (int(x.strip()) for x in l)
g would then create items as they are called for by some consumer (for instance, a for loop or a container object).
From what I can tell, the python community is not particularly obsessed with quoting monty python. More than 0, but much less than all the time. So maybe only hold that against the language a little bit.
No doubt these would be faster in C, but I don't think they would be particularly clearer:
http://norvig.com/sudoku.html
http://norvig.com/spell-correct.html
I don't think I was trying to argue that the model M was slow, more that typing speed isn't something a whole lot of folks run into on a regular basis.
It's nice that you think they are plenty fast though.
Offtopic:
Manufacturing is alive and well in the United States. The job growth from manufacturing isn't particularly strong though, as there is tons of automation. One guy running a couple of CNC lathes is more productive than 4 guys running manual lathes, and so on. Or something like Hyundai, where the spend less per vehicle on welding, but have higher consistency, because they are fully automated.
What's fast?
I don't type all that fast, but I am rarely held up my typing speed.
I just scored 62 wpm here:
http://play.typeracer.com/
I don't think that it enormously fast (looking at the high scores...), but it is fast enough for the vast majority of the work I do.
Clearly, it likes marshmallows.
Well that explains SciFi movies:
http://science.slashdot.org/comments.pl?sid=567543&cid=23585235
"Conceived" is an awful strong word for one of those movies.
Maybe "amorphously blobbed together" or "agglomerated" or something.
But think of the science!
Gotta love appeals to emotion that you can get behind.
With no adamantium you'd have the craze inducing fragile bone claws. I imagine it would hurt a rather large amount.
It may be easier to just take the hand.
He has so much money that the amount of money he has is no longer relevant to him. He is much more interested in how successful his efforts are.
Fair enough. I really hope that movies are eventually downloadable for restricted playback though, at much lower cost. I would love to be able to rent a movie for $1 and watch it for 72 hours or so. At that price, I don't care about being able to resell it or if I own it or whatever.
Oh, I realize that it varies a great deal from person to person, but I don't think that you are anywhere near the mean, or the median. To some extent, I expect that I use a good deal more space than your average computer user, and certainly more than the average person.
Epistemologically speaking, isn't it rather difficult to kill an insurgent anywhere other than their own backyard?
I mean, if they weren't in their own backyard, then they wouldn't be insurgents anymore.
You also had a box. You should have pointed at it.