How modules work in Python

Ben Finney ben+python at benfinney.id.au
Sun Nov 16 20:23:35 EST 2014


Abdul Abdul <abdul.sw84 at gmail.com> writes:

> Thanks for your nice explanation. For your answer on one of my
> questions:

(Please use “interleaved” posting style, for showing quoted material and
your responses <URL:https://en.wikipedia.org/wiki/Posting_style#Interleaved_style>.)

> * Modules don't have methods. open is an ordinary function in the module.*
>
> Isn't "method" and "function" used interchangeably?

No (or more accurately: if someone does use those interchangeably,
they're not correctly describing Python).

A method is always a function, but a function is not always a method.

A method is a function bound to a specific object instance.

-- 
 \      “As soon as we abandon our own reason, and are content to rely |
  `\       upon authority, there is no end to our troubles.” —Bertrand |
_o__)                                Russell, _Unpopular Essays_, 1950 |
Ben Finney




More information about the Python-list mailing list