logoalt Hacker News

ziml77last Wednesday at 4:32 PM0 repliesview on HN

It's probably best to act like more complex things are just syntax at the start. Leave the fact that something like range is just a normal function that returns a generator for later on.

Like if range was used like this:

    for i in range 1 to 100:
        pass
No one is going to ask how that works internally, so I don't think it's necessary to treat range(1, 100) any differently. For this usage it makes no difference if it's a generator, a list (excepting performance on large ranges), or if the local variable is incremented directly like a C-style for loop.