688 karma · joined June 12, 2008
They recently added a tutorial: http://doc.rust-lang.org/doc/tutorial.html
Of specific interest to language nerds may be the recent addition of interfaces (http://doc.rust-lang.org/doc/tutorial.html#interfaces), which cover some of the same ground as both C++ classes and inheritance as well as Haskell's typeclasses.
If either xrange or list comprehensions are implemented in C instead of Python, do you still think your version will run quicker? What do you think the likelihood of either or both of these being the case is on your Python implementation? How many name lookups and function calls do you think each version does? Do you think you should find out before writing longer and more complicated code to attempt to out-perform it?
On my machine, your implementation performed ~3 times slower than the naive idiomatic "[0 for _ in xrange(100)]" and closer to 4 times slower when I bumped the list size up to 20000. And your version was ~32 times slower than "[0] * 100" and around 60 times slower when I bumped the list size up to 20000.
So please, don't optimize without measuring and instead just write idiomatic code the first time.
The code, for reference:
def mk_list_1(size):
ls = []
cnt = 0
while cnt <= size:
ls.append(0)
cnt += 1
return ls
def mk_list_2(size):
return [0 for i in xrange(size)]
def mk_list_3(size):
return [0] * size
from timeit import timeit
args = {
"number":1000000,
"setup":"from __main__ import mk_list_1, mk_list_2, mk_list_3"
}
print "Executing %i runs:" % args["number"]
print "mk_list_1 took %i s" % timeit('mk_list_1(100)', **args)
print "mk_list_2 took %i s" % timeit('mk_list_2(100)', **args)
print "mk_list_3 took %i s" % timeit('mk_list_3(100)', **args)
Output on my machine: Executing 1000000 runs:
mk_list_1 took 32 s
mk_list_2 took 10 s
mk_list_3 took 1 sYou may be wondering why your comment got down-voted. It's not that we're a community of jerks, I promise. People just really prize a high signal-to-noise ratio here, and while we appreciate that you enjoyed the link, a better way to express that without adding noise is to up-vote the comment.
In general, you should post comments here only when the comment will provide value to someone else. That's largely the rubric by which it will be judged.
"Thinking that 'Hey, I like playing games, so maybe I'd like making them' is sort of like saying, 'Hey, I really like taking baths, maybe I'd like to be a plumber." -- Jesse Schell
To be a successful game developer, you not only have to love games, you really have to love MAKING games, too.
I'm not a big fan on limiting game play in this way, but I also recognize that different things work (or don't) for different people.
In short, saying Reagan had a big part in this is a claim I would support, but saying it's all Reagan's fault is clearly untrue, barring time travel.
I do think there's a political dimension to the change, but laying the blame at Reagan's feet exclusively seems like simple political point-scoring.
Edit: it's funny seeing this comment getting down-modded. I think I'm significantly more liberal than most people here, but it looks like people are upset that I called out empty partisanship? I fail to see anything particularly inflammatory about what I wrote.
It's hard to move out of the bottom quintile when the bottom quintile is generally doing so poorly, though of course it's possible, in some cases, to still do so.
No, I never said anything of the like. In fact, I said that the qualities more likely to make you successful are also likely to predict working long hours. What I would say is that if you could make two copies of the world, one where entrepreneurs work reasonable hours and one where they work extensive hours, they would generally have better outcomes with the former.
In essence, it seems that working in crunch mode for extended periods of time is a bad habit of highly motivated people.
"Entrepreneurial success generally requires a wide variety of different tasks."
Obviously, there are all sorts of businesses and all sorts of entrepreneurs, but I'm not sure that the data available suggests that working with varied tasks alleviates problems of fatigue. Additionally, the penalties of multitasking are generally well documented. If the tasks just need to be completed and are straight-forward, or if you're in a short lead-up to a deadline, certainly there are times when it makes sense to work extended hours.
However, there is evidence to suggest an inverse relationship may exist. Furthermore, hazing is effective in building solidarity, and people are generally more likely to retroactively justify hardship, which makes me think there may be a psychological bias towards overvaluing poor work/life balance.
In my particular line of work, Daniel Cook put it better than I ever could: http://www.lostgarden.com/2008/09/rules-of-productivity-pres...
In money, debt is debt, whether you acquired it by taking out a responsible mortgage or running up your credit card on bottles of Dom Perignon to impress your friends. In software, technical debt is technical debt whether it was wise or not. The point is, you're paying for it when you try to do other work on the project (interest) and it's gonna take time to fix (principle).
Saying "A mess is not technical debt" is silly. The metaphor is useful whether it was a good idea to get into debt or not.
Edit: s/Don/Dom/ -- thanks for the pointer!
To the extent that my use of cliche distracted from point, I am sorry I used it. Similarly, I find meta-discussion, such as critique of the language of each others posts to be distracting from important discussion.
Finally, you should hate the game. The voting system on sites like Digg, Reddit, HN, have very serious problems, and the "rhetorical tricks" like prefacing a post with "I'll probably be downvoted for saying this..." are an unintended consequence of a poorly designed incentive system. Maybe I'm oversensitive to this sort of thing as a game developer, but it seems to me worthwhile to address an incentive system which encourages people to write suboptimal posts that use these "rhetorical tricks".
I'm not advocating for the abolition of self-moderation, karma systems, etc. -- I'm just saying that the systems in place are rudimentary and leave much to be desired.
The place I have used this rhetorical technique (and I'm ashamed to admit I have, 'cause I find it irksome myself), is when I'm posting something I believe is correct or worth considering, but which goes against the overriding sentiment of the site. I believe it disarms people's unthinking, reflexive downvote, though I have only my own experience to draw this from.
Maybe you think this is being "needlessly defensive", but that sounds like someone who's never had a comment downvoted to oblivion only because its sentiment is unpopular.
I'm not really sure why being defensive would undermine someone's point.
"If what you're saying isn't worth potentially being downvoted for, delete it."
The point isn't the negative karma (though that is a motivator for most people), the point is that down-votes mean something is less likely to be read (due to mechanical filtering), or will be read as a troll rather than as a reasonable opinion. People put some stock in the hivemind's opinions.
To reiterate what the post you replied to said: don't hate the player, hate the game.
You may still dislike CFLs and that's fine, but you may also have just been exposed to crappy ones.
However, even if they could not be implemented immediately, coming out early, before the story really blew up, talking about it openly and frankly, and announcing these changes would have done wonders. Instead, they've been beaten up in the press for the last week or two for their relative silence.
Regardless, it looks like they're doing what they should be doing, and I hope it works out both for them and their customers.
I was not impeaching the intellectual output of the Nobel laureates associated with the Cato institute, but I do have to note here that none of them wrote this blog post, nor is there any indication that any of them reviewed it. I could further debate your name-dropping, but I've wasted enough key-strokes on this as is.
(I realize I'm being pedantic. As a game developer, this sort of playing fast-and-loose with words annoys me in the same way people talking about "programming in HTML" may annoy you.)
Regardless, while I think it overstates the case a bit, I do think that that pop-up is actually a good driver of user behavior, at least on a moment-to-moment level.
So no, super really has changed, and the syntax in the article does not work with very old version of Python.
By ordering off the menu, you agree to the price on it. Similarly, when you sign an agreement to pay someone for work done, one would hope you'll pay that person when the work is done. Sadly, reality teaches us that this is not always the case.