What is a “method” in Python?

0 votes
Can anyone, please, explain to me in very simple terms what a "method" is in Python?

The thing is in many Python tutorials for beginners this word is used in such a way as if the beginner already knew what a method is in the context of Python. While I am of course familiar with the general meaning of this word, I have no clue what this term means in Python. So, please, explain to me what the "Pythonian" method is all about.

Some very simple example code would be very much appreciated as a picture is worth a thousand words.
Oct 23, 2018 in Python by ana1504.k
• 7,890 points
38 views

1 answer to this question.

0 votes
It's a function which is a member of a class:

class C:
    def my_method(self):
        print "I am a C"

c = C()
c.my_method()  # Prints "I am a C"
answered Oct 23, 2018 by SDeb
• 13,210 points

Related Questions In Python

0 votes
2 answers

what is a class method in python?

Class Method  class method is the method which is ...READ MORE

answered Apr 8 in Python by MrBoot
• 1,210 points
68 views
+1 vote
3 answers
0 votes
1 answer

What is the meaning of “int(a[::-1])” in Python?

Assumming a is a string. The Slice ...READ MORE

answered Aug 27, 2018 in Python by Priyaj
• 56,960 points
88 views
0 votes
1 answer

How does Python know whether a variable in the class is a method or a variable?

In python objects/variables are wrapped into methods ...READ MORE

answered Sep 18, 2018 in Python by ariaholic
• 7,340 points
60 views
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6 in Python by Neha
• 330 points

edited Jul 8 by Kalgi 405 views
0 votes
1 answer

Is there a string 'contains' in python?

In this case, you can use the ...READ MORE

answered Sep 25, 2018 in Python by SDeb
• 13,210 points
71 views
0 votes
1 answer

Is there a stack/heap in Python?

Memory management in Python involves a private ...READ MORE

answered Nov 9, 2018 in Python by SDeb
• 13,210 points
364 views