Method / Functions - What are the differences?

John Posner jjposner at optimum.net
Wed Mar 3 15:58:46 CET 2010


On 3/3/2010 5:56 AM, Bruno Desthuilliers wrote:
> Eike Welk a écrit :
>> John Posner wrote:
>>> I've updated the text at this location:
>>>
>>> > http://cl1p.net/bruno_0301.rst/
>>
>> I think this is a very useful writeup!
>> It would be perfect with a little bit of introduction that says:
>> 1. - What it is: "The rough details of method look-up";
>> 2. - which contains some of the questions that that made that authors
>> write the text. This way people with similar questions can find it
>> with Google.
>>
>
> John, do you think you could something with the following ?

Sure thing, Bruno. I'll incorporate/edit your new text below into a 
Python Wiki entry. The headings in the Documentation table of contents 
page (http://wiki.python.org/moin/Documentation) seem pretty sober, so I 
plan to use a straightforward title:

   FromFunctionsToMethods

... instead of the clearly superior ...

   ItsAFunctionItsAMethodItsAUseOfTheDescriptorProtocol

Does this article belong in the "Advanced Topics" section of the page? 
I'm not sure, but I'll place it there for now. (Alternative suggestions 
welcome!)

>
> """
> "Is it a function ? is it a method ? No, it's... " - or : What's in a
> Python method ?
>
> Python newcomers often have hard time understanding the "magic" behind
> Python's methods - and truth is that Python's object model can be a bit
> peculiar when compared to most mainstream (or not-so-mainstream) OOPLs.
> As a matter of fact, there are quite a few threads on c.l.py with either
> direct or indirect questions about what makes a Python method, and I
> must have explained the whole mechanism at least 3 or 4 times there. The
> following text is an edited version of my last attempt, as edited,
> corrected and published by John Posner, MayHisNameBePraised(tm).
>
> This text isn't meant as a replacement for neither the official
> FineManual(tm)[XXX : relevant link] nor the very excellent - if somehow
> technical - 'Descriptors how-to' [XXX : relevant link]. It's mostly a
> brief but hopefully helpful overview of what exactly is a Python method,
> and how Python magically inserts the 'self' or 'cls' argument to method
> calls.
> """
>
> Feel free to edit / amend / rewrite / trash at will - you're now
> officially in charge of publishing this text !-)
>

Yow, the mantle of responsibility weighs heavily upon my poor shoulders!

Film at 11,
John




More information about the Python-list mailing list