what is a class method in python

0 votes
what is a class method in python.

how is it different from a static method in python?
Mar 12, 2019 in Python by Waseem
• 4,540 points

2 answers to this question.

0 votes

 class method is a method that is bound to a class rather than its object. It doesn't require creation of a class instance much like static method


  • Static method knows nothing about the class and just deals with the parameters
  • Class method works with the class since its parameter is always the class itself.

class method can be called by  the class and its object.




these both method are very frequently  used in python and it is one of the essential concept of python.it is very necessary to understand the concept of class method and statics method for having good experience and skill with regards to python.

answered Mar 19, 2019 by rajesh kumar
0 votes

Class Method 

  1. class method is the method which is bound to the class and not the object of the class.
  2. They have the access to the state of the class as it takes a class parameter that points to the class and not the object instance.
  3. It can modify a class state that would apply across all the instances of the class. For example it can modify a class variable that will be applicable to all the instances.

Static Method

  1. A static method is also a method which is bound to the class and not the object of the class.
  2. A static method can’t access or modify class state.
  3. It is present in a class because it makes sense for the method to be present in class.

If you want to know more about Python then i suggest you to pursue Diploma in Python Courses or Python Certification from where you can gain lots of knowledge and information.

answered Apr 8, 2019 by MrBoot
• 1,190 points

Related Questions In Python

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,440 points
0 votes
1 answer

What is a “method” in Python?

It's a function which is a member ...READ MORE

answered Oct 23, 2018 in Python by SDeb
• 13,300 points
+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,140 points
0 votes
1 answer

What is the process to kill a particular thread in python?

A multiprocessing.Process can p.terminate() In the cases where I want to ...READ MORE

answered Feb 4, 2019 in Python by charlie_brown
• 7,780 points
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 2,418 views
0 votes
0 answers
+5 votes
6 answers

Lowercase in Python

You can simply the built-in function in ...READ MORE

answered Apr 11, 2018 in Python by hemant
• 5,810 points