[Python-3000] Fw: typeclasses, duck-typing

Greg Ewing greg.ewing at canterbury.ac.nz
Fri May 12 04:50:39 CEST 2006


Phillip J. Eby wrote:

> I meant only the shift from typing "def __iter__(" to "defop iter(", 
> irrespective of how it's implemented.

On its own, that's no more than a syntax change,
with very little to recommend it. With the associated
semantics you propose, it's a very deep change indeed.

> My assumption is that a majority 
> of Python users would either not care which "magical" spelling was used, 
> would like getting rid of the '__',

These are large assumptions, which I suspect are at
least 87.43% wrong. Don't make the mistake of thinking
that everyone has the same preferences as you.

 > """Removal of __magic__ attributes
 >
 > Special attribute names like '__iter__' have been replaced with use of the
 > 'defop' keyword, for example, 'defop iter(self)'.
 >
 > Instead, I'd expect most people to view this as either neutral and of no
 > consequence, or as a positive improvement in readability and reduction of
 > magic.

If that were all it said, I'd think "!#$#??? Why are they messing
around with something that's not broken?" (i.e. naming of special
methods).

If it went on to talk about generic functions, I'd be very
uncomfortable, because I still have deep reservations about
that whole idea.

-- 
Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | Carpe post meridiem!          	  |
Christchurch, New Zealand	   | (I'm not a morning person.)          |
greg.ewing at canterbury.ac.nz	   +--------------------------------------+


More information about the Python-3000 mailing list