Confused with methods
Alex Martelli
aleaxit at yahoo.com
Sun Feb 6 17:56:07 EST 2005
jfj <jfj at freemail.gr> wrote:
> >>Isn't that inconsistent?
> >
> > That Python has many callable types, not all of which are descriptors?
> > I don't see any inconsistency there. Sure, a more generalized currying
> > (argument-prebinding) capability would be more powerful, but not more
> > consistent (there's a PEP about that, I believe).
>
> Thanks for the explanation.
>
> The inconsistency I see is that if I wanted this kind of behavior
> I would've used the staticmethod() builtin (which in a few words
> alters __get__ to return the function unmodified).
The staticmethod builtin would NOT have given you the behavior: "bind
the first argument". I do not know what you mean by "this kind of
behavior", but making a boundmethod most assuredly DOES give you
extremely different behavior from wrapping a function in staticmethod.
I still wouldn't see any "inconsistency" even if two different ways of
proceeding gave the same result in a certain case. That would be like
saying that having x-(-y) give the same result as x+y (when x and y are
numbers) is ``inconsistent''... the word ``inconsistent'' just doesn't
MEAN that!
"Inconsistent" means sort of the reverse: one way of proceeding giving
different results. But the fact that the same operation on objects of
different types may well give different results isn't _inconsistent_ --
it's the sole purpose of HAVING different types in the first place...!
Alex
More information about the Python-list
mailing list