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
• 5,910 points
13 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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
• 9,380 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
20 views
0 votes
2 answers

What do you mean by python scripting? What is a script and a module in python?

A scripting language is a programming language ...READ MORE

answered Mar 14 in Python by rajesh kumar
1,515 views
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,100 points
45 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,320 points
19 views
0 votes
1 answer

how can i count the items in a list?

suppose you have a list a = [0,1,2,3,4,5,6,7,8,9,10] now ...READ MORE

answered May 2 in Python by Mohammad
• 1,400 points
19 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
• 9,380 points
45 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
• 9,380 points
102 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.