[Python-3000] Fw: typeclasses, duck-typing
Steven Bethard
steven.bethard at gmail.com
Fri May 12 04:30:53 CEST 2006
On 5/11/06, Phillip J. Eby <pje at telecommunity.com> wrote:
> In other words, I mean that if most people saw something like this in
> "What's new in Python 3.0", I don't think they would freak out:
>
> """Removal of __magic__ attributes
>
> Special attribute names like '__iter__' have been replaced with use of the
> 'defop' keyword, for example, 'defop iter(self)'. Instead of defining a
> method named 'iter', 'defop iter' defines what the 'iter()' builtin will do
> when passed an object of the corresponding type. This feature makes it
> easy to create new generic operations like iter() and len() without having
> to define special attribute names and avoid collisions. See the table
> below for a complete list of translations..."""
FWIW, I wouldn't freak out. +0.5 on the general idea (and I'll avoid
any comment on the syntax since that's best left to a BDFL
pronouncement anyway). I like the thought of making the introduction
of new protocols easier. I expect that Python 3000 will continue in
the same way as Python 2.x, adding new protocols when someone figures
out a new way to make life easier. ;-)
I look forward to seeing your prototype. Maybe as an example, you
could discuss how it could have eased the introduction of the
__index__() method introduced in 2.5?
STeVe
--
Grammar am for people who can't think for myself.
--- Bucky Katt, Get Fuzzy
More information about the Python-3000
mailing list