[Python-3000] Builtin iterator type

Josiah Carlson jcarlson at uci.edu
Wed Nov 15 18:13:41 CET 2006


"George Sakkis" <gsakkis at rutgers.edu> wrote:
> As I wrote in my last reply to Nick though, I question Python's right to perform
> such limited forms of design-by-contract-like assertions ("why not add
> a precondition
> on __add__(self,other) to enforce isinstance(other, self.__class__)
> ?") when it refuses to formalize interfaces for sequences, iterators
> et al.

Because 5, 5+0j, 5.0 are different types.  To not be able to add any of
them because they are different types, would be silly.  Note that
Decimal is a different beast, which is why I don't include it.  There's
also string + unicode (at least in 2.x), and if some sort of
unicode view makes it into 3.x, view + unicode.

 - Josiah



More information about the Python-3000 mailing list