News for hackers. Stuff that matters.
Re:90% of My Skills Are Now Worth $0 by AceJohnny2 on Wednesday April 19, 2023 @07:53PM (#35634755)
oh I have another anecdote! I was just now looking up Python `iterators` vs `generators`, where I asked:

> In Python, what differentiates an iterator from a generator?

and it answered:

> [...] An iterator can be more flexible than a generator because it can maintain state between calls to __next__(), whereas a generator cannot. For example, an iterator can keep track of its position in a sequence, whereas a generator always starts over from the beginning. [...]

Which is flat-out wrong! Of course a generator can preserve state, otherwise how could it even work! (a generator preserves state implicitly by being a closure)"

(Of course, ChatGPT is an evolving system so yes I provided feedback on this. I'm sure in a year or two, I'll be looking back at this gotcha! and cringing.)

There are no comments on this comment yet.