Functions vs OOP
William Gill
nospam at domain.invalid
Mon Sep 5 20:30:47 EDT 2011
On 9/5/2011 3:04 PM, Jean-Michel Pichavant wrote:
> William Gill wrote:
>>
>> Not to split hairs, but syntactically f(x) is a function in many
>> programming paradigms.
>>
>> As I understand it functional programming places specific requirements
>> on functions, i.e.referential transparency. So f(x) may or may not be
>> "functional".
>>
>> x.f() is also a function, but it is a member of the object x, is
>> referred to as a 'method' of x, and uses the syntactical "dot"
>> notation object"dot"function for identification.
>>
>
> Functional programming is not about writing a programm with functions
> <snip>. This may cause some confusion.
It can, and it did. That was the impression I (incorrectly) got from
the documentation. Which didn't make sense to me.
> (google it for more info).
I can, and I did. That, and the answers I got in this ng are how I
corrected my misconception.
>
> Your original post was about functions vs methods, which are identical
> except some syntax detail. FYI, in python x.f() is equivalent to f(x).
> In an OOP world one will prefer the x.f() form.
>
No, my original post was about how (based on the aforementioned
misconception) the documentation seemed to suggest that OOP should never
have free standing functions, only methods.
More information about the Python-list
mailing list