Confused with methods

Antoon Pardon apardon at forel.vub.ac.be
Tue Feb 8 03:01:25 EST 2005


Op 2005-02-07, Alex Martelli schreef <aleaxit at yahoo.com>:
> Antoon Pardon <apardon at forel.vub.ac.be> wrote:
>
>> Yes it is inconsistent with the rest of python. That you found
>> a subset in which it is consistent doesn't change that.
>> 
>> And what if you do:
>> 
>>   c = C()
>>   c.f = g
>> 
>> 
>> The fact that a function in a class performs a lot of magic if
>> it is called through an instance, that isn't performed otherwise,
>> makes python inconsistent here. You may like the arrangement
>> (and it isn't such a big deal IMO) but that doesn't make it consistent.
>
> Any descriptor (be it a function or otherwise) has its __get__ method
> called, when _accessed_ by attribute syntax, if and only if that
> descriptor is in a class.  _ALL_ of Python is perfectly consistent on
> this point, and if I didn't already know the kind of crazy and obviously
> false assertions that you post *QUITE* consistently, I would be
> astonished to see you claim otherwise.  Knowing your posts, this latest
> idiocy is perfectly "par for the course".

No python is not consistent and your continuous repetion doesn't
make it so. To illustrate, here the following code:

class A:
  l = []
  def f(): pass

a = A()
print a.l is A.l
print a.f is A.f

which produces:

True
False


>
> "A lot of magic" is simply a stupid and imprecise way to describe "the
> __get__ method gets called".

So what? That is an implementation detail. 

> Saying that any of this happens when the
> function is CALLED is a definitely more serious mistake, since it's
> absolutely obvious that the __get__ method is called when the function
> (or any other attribute) is *ACCESSED* -- the call operation (on
> whatever object __get__ returns) happens AFTERWARDS.

Fine, I was imprecise. But your harping on my impression doesn't
change the fact that python doesn't work consistent here.

> Why you, and a few other habitual trolls, keep lowering the signal to
> noise ratio of this newsgroup with your blatherings, I don't know;

Well you can think me a troll, I think you are a zealot who gets
overly defensive if the "wrong" people try to suggest python has
some failing.

> I'm
> sure this behavior must be giving you guys some kind of satisfaction.
> Whether the damage you do to the clarity of the issues, and to the
> understanding of newbies who are unfortunate enough to read and trust
> the many imprecise and/or utterly false assertions you keep making,

Look we are all people, we all are imprecise at moments, including you.
But when the "wrong" people get imprecise you get into a fit on how
these people are trolls and try to get python into a bad daylight
instead of trying to understand what they really are trying to say
and reacting to that and maybe in the mean time correcting the
imprecession.

In this case the way python accesses class functions from an instance
is not consistent with how python accesses other class attributes
from an instance. I know it is designed that way and I can understand
hwy it was done. But this inconsistency can be a stumbling block for
a newcomer and I think that explaining why the inconsistency is present
is a better option than declaring there is no inconsistency.

> with
> totally unjustified airs of competence, is part of your jollies, or just
> a side effect you don't care a whit about, I don't know either.  Guess
> I'll just killfile you for another month now -- wish MacSOUP had a
> simple way to to permanent killfiling, since it's pretty obvious by now
> that it's quite unlikely you'll even post anything worthwhile at all.

Well whether I post something that is worthwhile to you, can only be
decided by you. I sometimes have my doubts about you too.

-- 
Antoon Pardon



More information about the Python-list mailing list