On 03/09/2011 17:15, William Gill wrote:
During some recent research, and re-familiarization with Python, I
came across documentation that suggests that programming using
functions, and programming using objects were somehow opposing
techniques.

It seems to me that they are complimentary.

I think you mean "complementary". :-)

It makes sense to create objects and have some functions that take
those objects as arguments. Are they suggesting that any function
that takes an object as an argument should always be a method of that
object? Conversely I can see creating functions that take raw input
(e.g. strings) and return it in a format compatible with an object's
constructor, rather than have objects accept any conceivable format
for its constructor.

Am I missing something, or am I taking things too literally?

I think that it's all about "state".

In functional programming, there's no state; a function's result
depends solely on its arguments, so it will always return the same
result for the same given arguments.

In OOP, on the other hand, an object often has a state; a method may
return a different result each time it's called, even for the same
given arguments.
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to