Python Forum
a Word Inside Parenthesis in Class Decleration
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
a Word Inside Parenthesis in Class Decleration
#3
You can write
class SomeName:
    """docstring"""
The class SomeName will be a subclass of 'object' which is the root ancestor of all classes.

In python 2, the explicit reference to 'object' was needed because for backwards compatibility, python 2's class system coexists with an old class system inherited from python 1. So in python 2 there are 'old style classes' (which don't inherit from 'object') and 'new style classes'. Only, the new style classes were new in 2001, but they're no longer new in 2019. In python 3, you can safely ignore the object parent class in the definition.
Reply


Messages In This Thread
RE: a Word Inside Parenthesis in Class Decleration - by Gribouillis - Dec-18-2018, 05:59 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
Question Problem: Check if a list contains a word and then continue with the next word Mangono 2 2,455 Aug-12-2021, 04:25 PM
Last Post: palladium
  Why does Python not use parenthesis to contain loops? davidorlow 3 3,399 Jun-09-2021, 06:33 AM
Last Post: Gribouillis
  Practice problem using lambda inside the class jagasrik 3 2,106 Sep-12-2020, 03:18 PM
Last Post: deanhystad
  How to read file inside class Mekala 11 12,247 May-02-2020, 11:36 AM
Last Post: snippsat
  Python Speech recognition, word by word AceScottie 6 15,856 Apr-12-2020, 09:50 AM
Last Post: vinayakdhage
  Is it mandatory to call superclass init inside the class init? psolar 3 5,913 Feb-14-2020, 09:16 PM
Last Post: wavic
  print a word after specific word search evilcode1 8 4,717 Oct-22-2019, 08:08 AM
Last Post: newbieAuggie2019
  parenthesis around a tuple of literals in a for Skaperen 2 2,142 Aug-25-2019, 03:00 AM
Last Post: Skaperen
  Parenthesis in User-Defined Functions giorgitsu 2 1,939 Aug-07-2019, 12:56 PM
Last Post: ThomasL
  Get variable from class inside another class hcne 3 2,768 Mar-30-2019, 03:02 PM
Last Post: ichabod801

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020