News for hackers. Stuff that matters.
Re:I have no side code projects to show by jonathankoren on Friday December 16, 2016 @08:34PM (#13198574)
The correct answer is of course, is that xrange doesn't exist.
Re:I have no side code projects to show by fencepost on Friday December 16, 2016 @10:59PM (#13199111)
I'd say that the correct answer would be "Which version of Python are you using?" but I actually kind of like the question - it's an important enough function that most people doing more than toy projects would have needed to use it at some point or at least would have considered it, but it's also something that has changed recently enough that people who are claiming long-term experience will have dealt with both versions.

My Python is rusty, but I actually had to go look up the differences - my initial thought was "I'm pretty sure it used to be that range() generated a list and xrange() basically just iterated a value, but at some point range() was changed to use the xrange() behavior - I'd have to look it up to give you more detail than that." I didn't realize that xrange() had been completely removed from 3.x, for example. For that matter, I was thinking that both of them might have existed in 1.x, though it looks like they were added in 2.0.

Re:I have no side code projects to show by logicallee on Friday December 16, 2016 @08:50PM (#13198635)
In short, it's the default behavior in Python 3; it doesn't exist anymore:

http://pythoncentral.io/how-to-use-pythons-xrange-and-range/

From that article (buried near the end for some reason):

>One more thing to add. In Python 3.x, the xrange function does not exist anymore. The range function now does what xrange does in Python 2.x, so to keep your code portable, you might want to stick to using range instead.

Re:I have no side code projects to show by ant6n on Friday December 16, 2016 @08:51PM (#13198641)
so they removed it from python 3?
Re:I have no side code projects to show by OJFord on Friday December 16, 2016 @10:49PM (#13199067)
`range` took the behaviour of `xrange`; the latter name was removed.

https://docs.python.org/3/whatsnew/3.0.html#views-and-iterat...

Re:I have no side code projects to show by brianwawok on Friday December 16, 2016 @08:53PM (#13198650)
And if they don't agree or laugh, time for a table flip.