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,910 points
749 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,300 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, 2019 in Python by MrBoot
• 1,230 points
1,213 views
+1 vote
7 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
• 58,020 points
6,471 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 aryya
• 7,460 points
1,166 views
0 votes
2 answers
+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 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,434 views
0 votes
1 answer
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,300 points
696 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,300 points
1,743 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP