[Python-3000] Fwd: defop ?

Calvin Spealman ironfroggy at gmail.com
Sat Nov 25 03:35:24 CET 2006


On 11/23/06, Guido van Rossum <guido at python.org> wrote:
> On 11/22/06, Calvin Spealman <ironfroggy at gmail.com> wrote:
> > 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.
>
> How was I to generalize from a single example what you meant? I
> thought you were using 'operator' as a fixed keyword like it is in
> C++, and I was wondering what you meant by the double colon.
>
> I still believe it is easy enough to solve this using a naming convention.

Sorry, I meant it in the context of this thread, where the previous
examples where using the operator module (which, by virtue of
existing, should suggest that I wasn't implying its name for use in
some other way).

Naming conventions will only take us so far before we run into
conflicts more often than we can offord. We only have one convention
for special names, really, and it will run up its invitation with or
without a suitable solution around its limitations. I understand the
associtiation of this with "Too Much Magic" or simply the idea that
its more than is needed, overkill, etc. and I share that warriness.
But its something to consider, I suppose. I guess the thing to
consider is simply, "What's in a name?"

Another suggestion for this proposal:

class MyList(object):
    def __builtins__::len(self):
        return 0

This would basically say that MyList has a method identified by the
len attribute of __builtins__. Does that make sense? Maybe the syntax
isn't enjoyable but the effect is more the value I see, so are there
other ways it could be expressed?


More information about the Python-3000 mailing list