[Python-Dev] Re: Reiterability
Paul.Moore at atosorigin.com
Mon Oct 20 05:47:38 EDT 2003
From: Alex Martelli [mailto:aleaxit at yahoo.com]
> Basically, by exposing suitable methods an iterator could "make its
> abilities know" to functions that may or may not need to wrap it in
> order to achieve certain semantics -- so the functions can build
> only those wrappers which are truly indispensable for the purpose.
> Roughly the usual "protocol" approach -- functions use an object's
> ability IF that object exposes methods providing that ability, and
> otherwise fake it on their own.
I'm glad you pointed this out. This whole thing was starting to sound
very like the sort of thing that the adaptation PEP was intended to
Can the people who need this get the capability via a suitable
adaptation approach? I'm not familiar enough with the technique to
be sure. If so, wouldn't that be a more general technique (as well
as being already available in 3rd party modules like PyProtocols).
More information about the Python-Dev