"AK" == Andrew Koenig firstname.lastname@example.org writes:
Barry> Would it be useful to add to the interator "interface" a Barry> method which would retrieve the original iterable object?
AK> What if there isn't one?
Barry> The method would return None.
AK> But then you can't rely on it. That is, if you want to write AK> code that depends on the ability to retrieve the original AK> iterable, you have to give up the ability for that code to AK> work on generators, for example.
AK> I'm not saying it's not a useful thing to have; I'm just AK> saying it might not be as useful as it appears at first.
I'm not sure it's even useful at all, e.g. I've never had a use for it. But if you have code that depends on the ability to retrieve the original iterable, and you have iterators for which there /is no/ original iterable, it doesn't matter how you spell it, you're going to have to special case around that fact.