Functions vs OOP
William Gill
nospam at domain.invalid
Mon Sep 5 14:58:29 EDT 2011
On 9/3/2011 12:25 PM, Steven D'Aprano wrote:
> William Gill wrote:
>
>> Are they suggesting that any function that takes an object as an
>> argument should always be a method of that object?
>
> Yes.
I can think of times when a special application, such as a converter,
would take an object as an argument, but the somewhat unique nature of
the application wouldn't justify changing the class to make the behavior
into a method.
I could extend the underlying class to include the new behavior
(method), but that would mean existing instances of the base class would
need conversion to the new class, requiring yet another method.
Seems to me, that would be POOP (Puristic Object Oriented Programming) ;-)
More information about the Python-list
mailing list