Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Object and type class
#3
All objects inherit from object. Testing objects against object should be always True, even if you check type against object.

The normal use is:
my_object = [1, 2, 3]
print(isinstance(my_object, list))
print(isinstance(my_object, tuple))
Output:
True False
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply


Messages In This Thread
Object and type class - by Uchikago - Jul-28-2019, 07:47 AM
RE: Object and type class - by ThomasL - Jul-28-2019, 08:54 AM
RE: Object and type class - by DeaD_EyE - Jul-28-2019, 10:35 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Printing out incidence values for Class Object SquderDragon 3 288 Apr-01-2024, 07:52 AM
Last Post: SquderDragon
  error in class: TypeError: 'str' object is not callable akbarza 2 512 Dec-30-2023, 04:35 PM
Last Post: deanhystad
  Use a class type in it MathisDELAGE 2 912 Jan-29-2023, 11:37 AM
Last Post: MathisDELAGE
  declaring object parameters with type JonWayn 2 900 Dec-13-2022, 07:46 PM
Last Post: JonWayn
  search a list or tuple for a specific type ot class Skaperen 8 1,926 Jul-22-2022, 10:29 PM
Last Post: Skaperen
Exclamation win32com: How to pass a reference object into a COM server class Alfalfa 3 4,881 Jul-26-2021, 06:25 PM
Last Post: Alfalfa
Star Type Error: 'in' object is not callable nman52 3 3,392 May-01-2021, 11:03 PM
Last Post: nman52
  Python generics: How to infer generic type from class attribute? Thoufak 0 2,820 Apr-25-2021, 09:31 AM
Last Post: Thoufak
  AttributeError class object has no attribute list object scttfnch 5 3,429 Feb-24-2021, 10:03 PM
Last Post: scttfnch
  Python Class and Object Parameters JoeDainton123 5 2,894 Sep-02-2020, 10:43 AM
Last Post: JoeDainton123

Forum Jump:

User Panel Messages

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