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 7440945
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:55:49+00:00 2026-05-29T10:55:49+00:00

>>> import sys >>> sys.version_info (2, 4, 4, ‘final’, 0) >>> class C: …

  • 0
>>> import sys
>>> sys.version_info
(2, 4, 4, 'final', 0)
>>> class C:
...    pass
...
>>> issubclass(C, C)
True
>>> issubclass(C, object)
False
>>> class T(object):
...    pass
...
>>> issubclass(T, T)
True
>>> issubclass(T, object)
True
>>>

Question 1> Why C is a subclass of C?

Question 2> what is the base class of C?

Thank you

// Update for Chris Morgan (At least for me, the following manual doesn’t help at all)

>>> help(issubclass)
Help on built-in function issubclass in module __builtin__:

issubclass(...)
    issubclass(C, B) -> bool

    Return whether class C is a subclass (i.e., a derived class) of class B.
    When using a tuple as the second argument issubclass(X, (A, B, ...)),
    is a shortcut for issubclass(X, A) or issubclass(X, B) or ... (etc.).
  • 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-05-29T10:55:50+00:00Added an answer on May 29, 2026 at 10:55 am

    Take a look at issubclass(class, classinfo) documentation

    Return true if class is a subclass (direct, indirect or virtual) of
    classinfo. A class is considered a subclass of itself. classinfo may
    be a tuple of class objects, in which case every entry in classinfo
    will be checked. In any other case, a TypeError exception is raised.

    and to check base class of C use inspect.getmro(cls) function.

    Return a tuple of class cls’s base classes, including cls, in method
    resolution order.

       >>> class C(object):
    ...        pass
    ...
    >>> inspect.getmro(C)
    (<class '__main__.C'>, <type 'object'>)
    >>>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

import sys words = { 1 : 'one', 2 : 'two', 3 : 'three',
import sys sys.path.append('/home/myuser/svn-repos/myproject') from myproject.settings import * But, it says module not found when
Consider this python program: import sys lc = 0 for line in open(sys.argv[1]): lc
The python implementation import sys def move(src, dst, tmp, num): if num == 1:
The only nice way I've found is: import sys import os try: os.kill(int(sys.argv[1]), 0)
In python 2.x I could do this: import sys, array a = array.array('B', range(100))
Firstly, here's my script: #!/usr/bin/python import sys, os sys.path.append('/home/username/python') sys.path.append(/home/username/python/flup) sys.path.append(/home/username/python/django) # more path
i have the following script import getopt, sys opts, args = getopt.getopt(sys.argv[1:], h:s) for
If this is my subprocess: import time, sys for i in range(200): sys.stdout.write( 'reading
It's weird to me that the import fails even when it's in the sys.path

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.