Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8649233
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T13:30:36+00:00 2026-06-12T13:30:36+00:00

Under the classmethod() built-in function in the 2nd chapter itself of the Python Standard

  • 0

Under the classmethod() built-in function in the 2nd chapter itself of the Python Standard Library, I was confused with the two statements, that I’m quoting here: –

A class method receives the class as implicit first argument, just
like an instance method receives the instance.

Ok, till this part I was clear enough, that a classmethod is specific for a class, so, instead of taking self as an implicit argument, which represents an instance of that class, we use cls, which represents the class itself, and binds that classmethod to the class..

Now, here’s another statement later on in this topic which confused me: –

If a class method is called for a derived class, the derived class
object is passed as the implied first argument.

Now, what that is supposed to mean? Is it trying to say that, we actually pass an object to a classmethod when used in this situation? But doesn’t this contradicts the first statement itself.

Can anyone make me understand, how those two statements go hand-in-hand without contradicting each others??

I tried to find out some resource, but couldn’t find an example, demonstrating the second case..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T13:30:38+00:00Added an answer on June 12, 2026 at 1:30 pm

    A class is a fully-featured first-class object, just like instances of that class are (though they are obviously not the same objects). When we say a classmethod of class C receives the “class object” as first argument, we say it receives an object which represents a, not an object for which isinstance(<the object>, C) is true. The latter is called (class) instance, “class object” is reserved for objects which are classes.

    The second sentence simply clarifies that if the class method is called on a derived class, the class method receives that derived class (AKA “the derived class object”), to enable polymorphic behaviour. For example (Python 3, because f..k old style classes):

    class C:
        x = 1
    
        @classmethod
        def m(cls):
            return cls.x
    
    class D(C):
        x = 2
    
    print(C.m()) # 1
    print(D.m()) # 2
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm confused on Delegates. I was always under the impression that if you didn't
Under JBoss 4.0.1SP1, I have a servlet that makes multiple, concurrent calls to web
Under Solution->Properties, I can set multiple start-up projects: I know that I can get
under The Thumb instruction set in section 1-34 of ARM11TechnicalRefManual it said that: The
Under Windows, executing the following Python script I get an ERRORLEVEL of 0 instead
Under iOS there are several built in hooks for launching service-specific apps based on
Under VS's external tools settings there is a Use Output Window check box that
Under what circumstances might you want to use multiple indirection (that is, a chain
I have two classes that communicate with each other (processes in each class depend
Under Ubuntu 10, I installed using: npm install js2coffee Seems to install smoothly I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.