News for hackers. Stuff that matters.
Re:Pycraft: Minecraft engine in Python by mentos on Tuesday April 19, 2016 @05:52AM (#11525867)
The cost of abstraction.

If it doesn't affect performance then who's thinking is "wrong" here?

Re:Pycraft: Minecraft engine in Python by mousa on Tuesday April 19, 2016 @09:39AM (#11526806)
What abstraction? Comparisons are ubiquitous, easy to read, and a one-liner as well. If the range were to change it could affect performance. I've never seen anything written like the original loop, it's not like it's a Python idiom or anything. I'd say it's the wrong way to do things.
Re:Pycraft: Minecraft engine in Python by mentos on Tuesday April 19, 2016 @10:12AM (#11527073)
The abstraction is in removing the cognitive overhead needed to understand this. The original programmer can now allocate the time saved to higher level concerns. That is what C did for assembly and what Python is doing for C. Is that not the theme of abstraction?
Re:Pycraft: Minecraft engine in Python by blktiger on Tuesday April 19, 2016 @11:40AM (#11527722)
In this case I actually think the cognitive overhead is larger for the in range(5) call. You have to know how that will behave, is it 1 <= x < 5 or 1 <= x <= 5? The comparisons are more explicit and they are quite easy to read in this case.