[Python-3000] guessing a rule of thumb for methods on object
Steven Bethard
steven.bethard at gmail.com
Sat Jul 29 19:33:39 CEST 2006
On 7/28/06, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> Steven Bethard wrote:
>
> > I thought about this for a while, and I think maybe a good rule of
> > thumb (and something like what Python seems to follow) is: "If it's
> > there's an obvious default implementation of a protocol that would be
> > generally useful, it should go on all objects."
>
> Please, no!
>
> One of the things I like about Python is that 'object'
> is very nearly a blank slate. I'd hate to see it cluttered
> up with a pile of methods that someone thought might be
> useful to someone sometime.
Of course not. That's the whole point. The only things that belong
there are *protocols* (as in language-defined __XXX__ methods) that
have a sensible default implementation for all objects. AFAICT, the
only things this really applies to are __hash__ and __eq__ and the
other things that are already there (__class__, __{get|set|del}attr__,
etc.).
STeVe
--
I'm not *in*-sane. Indeed, I am so far *out* of sane that you appear a
tiny blip on the distant coast of sanity.
--- Bucky Katt, Get Fuzzy
More information about the Python-3000
mailing list