Re: functions vs methods

2018-07-22 Thread Chris Angelico
On Mon, Jul 23, 2018 at 1:49 AM, MRAB wrote: > On 2018-07-22 10:08, Ben Finney wrote: >> >> INADA Naoki writes: >> >>> Please don't refer the FAQ entry. >>> See this: https://bugs.python.org/issue27671 >> >> >> Interesting. Thanks for raising that bug report. >> >> I offer my text as a starting

Re: functions vs methods

2018-07-22 Thread MRAB
On 2018-07-22 10:08, Ben Finney wrote: INADA Naoki writes: Please don't refer the FAQ entry. See this: https://bugs.python.org/issue27671 Interesting. Thanks for raising that bug report. I offer my text as a starting point for a better explanation: Because ‘len’ works with *any*

Re: functions vs methods

2018-07-22 Thread Ben Finney
INADA Naoki writes: > Please don't refer the FAQ entry. > See this: https://bugs.python.org/issue27671 Interesting. Thanks for raising that bug report. I offer my text as a starting point for a better explanation: Because ‘len’ works with *any* sequence, not only lists. To implement

Re: functions vs methods

2018-07-22 Thread INADA Naoki
> > Your particular question is itself a FAQ > https://docs.python.org/3/faq/design.html#why-does-python-use-methods-for-some-functionality-e-g-list-index-but-functions-for-other-e-g-len-list>. > Please don't refer the FAQ entry. See this: https://bugs.python.org/issue27671 -- INADA Naoki --

Re: functions vs methods

2018-07-22 Thread Sharan Basappa
On Sunday, 22 July 2018 13:32:16 UTC+5:30, Ben Finney wrote: > Sharan Basappa writes: > > > Is there a difference between functions and methods in Python. > > Python's documentation includes a useful Glossary. See the terms > https://docs.python.org/3/glossary.html#term-method> >

Re: functions vs methods

2018-07-22 Thread Ben Finney
Sharan Basappa writes: > Is there a difference between functions and methods in Python. Python's documentation includes a useful Glossary. See the terms https://docs.python.org/3/glossary.html#term-method> https://docs.python.org/3/glossary.html#term-function>. Every method is a function; but

Re: functions vs methods

2018-07-21 Thread dieter
Sharan Basappa writes: > Is there a difference between functions and methods in Python. Somewhat simplified: a method is a function with the method's associated object implicitly passed as first argument. For a Python defined method "m", you can get the corresponding function via "m.__func__"

Re: functions vs methods

2018-07-21 Thread Sharan Basappa
Thanks a lot. On Sunday, 22 July 2018 04:02:23 UTC+5:30, Rick Johnson wrote: > On Saturday, July 21, 2018 at 2:06:21 PM UTC-5, Sharan Basappa wrote: > > Is there a difference between functions and methods in Python. > > Generally speaking, functions and methods are basically two > words

Re: functions vs methods

2018-07-21 Thread Lele Gaifax
Sharan Basappa writes: > Refer to the following lines: > 1) len(list) > 2) list.append() > > In the first case, len is a function that python provides to which list can > be passed and in the second case, append is a method within list class? > > If my interpretation is correct, why not make

functions vs methods

2018-07-21 Thread Sharan Basappa
Is there a difference between functions and methods in Python. For example, this is the text from tutorialpoint on Python: Python includes the following list functions - cmp, len etc. Python includes following list methods - append, count A related question. Refer to the following lines: 1)