Phillip J. Eby wrote: > >But it _does_ perform an implicit adaptation, via PyObject_GetIter. > > First, that's not implicit. Second, it's not adaptation, either. > PyObject_GetIter invokes the '__iter__' method of its target -- a > method that is part of the *iterable* interface. It has to have > something that's *already* iterable; it can't "adapt" a non-iterable > into an iterable. > > Further, if calling a method of an interface that you already have in > order to get another object that you don't is adaptation, then what > *isn't* adaptation? Is it adaptation when you call 'next()' on an > iterator? Are you then "adapting" the iterator to its next yielded > value? That's one (contrived) way of looking at it. Another is that y = iter(x) adapts the iterable protocol to the iterator protocol. I don't (yet) see why a bit of state disqualifies this from being called adaptation. > No? Why not? It's a special method of the "iterator" interface, > just like __iter__ is a special method of the "iterable" interface. The difference it that the result of .next() doesn't have a specified interface. > So, I can't see how you can call one adaptation, but not the other. > My conclusion: neither one is adaptation. Maybe... Just
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4