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 11 in Python by Waseem
• 4,480 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 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 by MrBoot
• 1,210 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 ariaholic
• 7,340 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,160 points
+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,900 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 in Python by charlie_brown
• 7,720 points
+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 277 views
+4 votes
6 answers