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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T11:39:22+00:00 2026-06-14T11:39:22+00:00

example #1: class Person(object): pass example #2: class Person: pass What does the object

  • 0

example #1:

class Person(object):
    pass

example #2:

class Person:
    pass

What does the object declaration do? Should you use it? I have a bunch of programs with both of them and don’t know the difference it is making. If anyone can explain this concept please.

  • 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-14T11:39:23+00:00Added an answer on June 14, 2026 at 11:39 am

    In Python2, declaring object as the base class makes the class a new-style class. Otherwise, it is a “classic” class. Among the differences are that

    • Properties only work with new-style classes

    • new-style classes have the mro method

    • new-style classes have many attributes that classic classes lack

      In [288]: class Foo: pass
      In [289]: dir(Foo) 
      Out[289]: ['__doc__', '__module__']
      
      In [290]: class Bar(object): pass
      In [291]: dir(Bar) 
      Out[291]:  ['__class__',  '__delattr__',     '__dict__',  '__doc__',  '__format__',  '__getattribute__',     '__hash__',  '__init__',  '__module__',  '__new__',  '__reduce__',     '__reduce_ex__',  '__repr__',  '__setattr__',  '__sizeof__',     '__str__',  '__subclasshook__',  '__weakref__']
      

    Classic classes are retained in Python2 only for backwards compatibility. All custom classes you define should be made new-style.

    In Python3, all classes are new-style, so it need not be explicitly declared there.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Example-I have a person class Public Class Person Private _fname As String Public Property
Say, I have a Person object list called people: public class Person { public
I have the following code. class person(object): def __init__(self, keys): for item in keys:
I have a Person object: public class Person { public string Name { get;
I have models (simplified example): class Group(models.Model): name = models.CharField(max_length = 32) class Person(models.Model):
How can we find out the size of a Java object? Example: class Person{
Consider this simple example - public class Person { private String name; private Date
I have an example class containing two data points: public enum Sort { First,
I have a simple class as defined below: public class Person { int _id;
Say I have a Person object that has a first name, a last name

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.