I like it. I too have run into that problem ( and sometimes I haven't
even NOTICED that it was a potential problem, as in the case you picked
> Actually, I once toyed with the idea to have every object return something,
> itself by default (a la Smalltalk). Then you add an ignore() method to all
> objects. This would result in being able to say
Well, pulling another card out of my list of things which I had
intended to wait until next year to start discussing ( knowing
that Guido is hard at work on the 1.0 release now... ), BUT:
[ This is actually unrelated to your suggestion, but your suggestion
reminded me of it. ]
I was considering proposing that in addition to __getitem__, etc.
that if a method __func__ is defined, then that is the default
function and can be called by 'object()' as well as
They other reason I didn't post this suggestion earlier is that
I haven't quite marshalled all of my arguments FOR this feature.
In short, though, the reason is to extend the capability of
separating interface from implementation. It is suggested by
the usefulness of the sequence like object interface.
You can return a method from Class().init(), but now the
convention is to use __init__, which doesn't allow a non
None return. Of course, the negative argument is that is
doesn't add much over tha existing capability.
[ There is also an argument against introducing something
so context dependent, but it's really no more context
dependant than 'object[i]' . ]
Now that I've gone ahead and brought this up, I'll now try to
forget about it until next year, when I have time to assemble
a better argument.
- Steve M.