Hi Artem Pulkin,
Like Milton, I also do not really understand your question, sorry.
Perhaps it is too advanced and tied to the internal implementation.
If you could explain in more detail, with some sample code and data,
that might help.
Alternatively, you could try asking on the Python-Dev mailing list.
Milton made a comment about
“range(9999) would be implemented as a generator”
This is a common myth about range. It is not a generator, it is a lazy
sequence that computes its values only as needed, not in advance.
→ returns False
range works something like this simplified version:
def __init__(self, start, stop, step=1):
self.start = start
self.stop = stop
self.step = step
def __getitem__(self, i):
value = self.start + i*self.step
if value < self.stop:
So range has nothing to do with generators. Never has, never will