Distinguishing attributes and methods
Roy Smith
roy at panix.com
Sat Dec 8 19:18:15 EST 2007
In article <475b17dc$0$31712$426a74cc at news.free.fr>,
Bruno Desthuilliers <bdesth.quelquechose at free.quelquepart.fr> wrote:
> MonkeeSage a écrit :
> > On Dec 8, 2:51 pm, Glenn Hutchings <zond... at googlemail.com> wrote:
> >
> >>On Dec 8, 7:44 pm, MonkeeSage <MonkeeS... at gmail.com> wrote:
> >>
> >>
> >>>I think it muddies the water to say that a.a() and a.a are the same
> >>>thing--obviously they are not.
> >>
> >>A thing is not what it is;
> >>A thing is what it does.
> >>This is the Way of the Duck.
> >>
> >> -- Basho (in his "3 extra syllables" phase)
> >
> >
> > Bah. Type-by-behavior never impressed me much. And I still think that
> > a.a is semantically different from a.a() in python.
>
> It is indeed and very obviously semantically different, and no one said
> it wasn't. The first is an attribute lookup, the second is an attribute
> lookup followed by a call. Now this doesn't make the attribute lookup
> part different in both cases...
There are a very few corner cases were you can leave the ()'s out. For
example, you can do;
raise Exception
or
raise Exception()
but stuff like that is very much a wart in the language syntax.
More information about the Python-list
mailing list