[Python-3000] Fwd: defop ?

Calvin Spealman ironfroggy at gmail.com
Thu Nov 23 08:10:57 CET 2006


I need to move away from the GMail client for lists or they need to
fix it. Sorry Guido, forwarding to the list as GMail should be doing
in the first place!

---------- Forwarded message ----------
From: Calvin Spealman <ironfroggy at gmail.com>
Date: Nov 23, 2006 2:10 AM
Subject: Re: [Python-3000] defop ?
To: Guido van Rossum <guido at python.org>


On 11/22/06, Guido van Rossum <guido at python.org> wrote:
> Not sure I like this better. My spelling of "operator::XXX" is
> "__XXX__" and I like that just fine -- no new syntax needed.

Well, that might be a spelling of `operator::XXX` but what about other
use cases like `third_party_interface_system::adapt` or
`anything_at_all::XXX`? Thats what I mean with not being too limiting
and solving the problem in a way that opens up solutions to other
problems. I get the opposition to it, but it seems reasonable,
nonetheless.

On 11/22/06, Phillip J. Eby <pje at telecommunity.com> wrote:
> So, how does that work for adding methods after the fact, *outside* of a
> class?  (See Guido's BinaryTree flattening example.)

class MyClass(object):
  pass
MyClass.operator::iter = lambda self: iter((self.a, self.b, self.c))

Or, possibly:

def MyClass.operator::iter(self):
  yield a
  yield b
  yield c

But, I understand if that would get even more opposition, so I won't
push it, but its on the table.

Read my blog! I depend on your acceptance of my opinion! I am interesting!
http://ironfroggy-code.blogspot.com/


-- 
Read my blog! I depend on your acceptance of my opinion! I am interesting!
http://ironfroggy-code.blogspot.com/


More information about the Python-3000 mailing list