Python 3K or Python 2.9?
Bruno Desthuilliers
bdesth.quelquechose at free.quelquepart.fr
Sun Sep 16 15:21:05 EDT 2007
Erik Jones a écrit :
> On Sep 14, 2007, at 11:54 PM, David Trudgett wrote:
>
>> TheFlyingDutchman <zzbbaadd at aol.com> writes:
>>
(snip)
>>
>> Several languages use the "object.method(args)" form, which is syntactic
>> sugar for "method(object, other_args)" which Ada, for instance, uses.
>> Knowing this clears up half the confusion (the object /is/ passed as a
>> parameter whichever syntax is used).
>>
>> The other half of the confusion is cleared up by considering that
>> Python methods are ordinary functions that don't magically "know" in
>> which "class" context they are executing: they must be told via the
>> first parameter.
>
>
> Yes, that is really the crux of the issue, though. While the former
> may be syntactic sugar for the latter, once any syntactic sugar has
> become prevalent enough, it becomes the expected norm
Being "the expected norm" is not enough to qualify has "being the right
thing to do".
> and the latter
> becomes clutter or, at best, awkward.
Until you want to dynamically add some generic function taking an object
as first arg as a method of a class or instance. Exposing most of the
inner working of it's object model is one of the greatest strength of
Python. And that's one of the reasons I (and probably other people here)
like this language.
> It's something that really just
> takes a little use until you get to the point where you don't usually
> think of it but, every so often, the thought creeps in. I'm not
> complaining, just pointing out if you step out of this particular box,
> you'll realize that it really is a pointless one. Saying, "because
> that's how Python does it" may be the only valid reason, but that
> argument is about on par with a six year old's "just because...".
If you really think the only rationale for this is "just because", then
you're missing something IMHO.
More information about the Python-list
mailing list