Ian Kelly <ian.g.ke...@gmail.com> wrote: > On Sat, Sep 3, 2011 at 10:15 AM, William Gill <noreply@domain.invalid> 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. 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 you may be confusing "functional programming" and "programming > using functions". These are not the same thing. > > Functional programming is about using functions in the *mathematical* > sense. A mathematical function maps one value (or tuple of values) to > another value. The mapped value never varies; if it did, it would be > a different function. So functional programming eschews the use of > functions where the results depend on any internal or external state > beyond the values of the passed-in arguments, such as the variable > state of the object the method is being called on. > I think there may be another issue here. If someone says "functional programming" to me then I would generally assume that they *do* mean "programming using functions". While your distinction of the two may be strictly correct I don't think it's the generally accepted meaning.
-- Chris Green -- http://mail.python.org/mailman/listinfo/python-list