[Python-3000] Builtin iterator type

Greg Ewing greg.ewing at canterbury.ac.nz
Sun Nov 19 02:15:49 CET 2006


Bill Janssen wrote:

> But when you do have to test, it would be nice to be able to
> test for a semantic item rather than a syntactic one.

In your own code, there's nothing to stop you from
creating your own interface classes to use in your
own tests.

But when it comes to interoperating with other
people's code, you can't rely on them having
inherited from all the classes you want to test
for, so the testing approach isn't much use.
Unless you require everyone to inherit from a
standard set of base classes, and then we're
back in Java-land.

Anyhow, I've yet to see a case where you really
*need* that sort of testing. Whenever someone asks
something like "how do I tell whether I've got a
sequence or not", usually it's a symptom of poor
API design, IMO.

--
Greg


More information about the Python-3000 mailing list