instance
One particular object made from a class, with its own attribute values.
In more detail
Two instances of the same class share its methods but keep their own data, so changing one dog's name does not rename another. isinstance(x, Dog) asks whether x was made from Dog or a subclass of it.
Related terms
- class — A blueprint in code that bundles data and the functions that work on it, from which objects are made.
- instance attribute — An attribute stored on one instance, usually set as self.name = value, so each instance has its own copy.
- isinstance() — isinstance(obj, cls) asks whether an object is an instance of a class or any subclass of it; issubclass does the same for two classes.
Taught in
- Idle And The Python Shell — Hands-on Python: Complete Video Course & Book
- Types And Functions, A Whirlwind Tour — Hands-on Python: Complete Video Course & Book
- Classes And Instances — Hands-on Python: Complete Video Course & Book
- Methods, Attributes And self — Hands-on Python: Complete Video Course & Book
- Handlers, args, raise And assert — PCAP Certified Associate in Python Programming (PCAP-31-03) Exam Prep
- Classes, Objects And Two Stacks — PCAP Certified Associate in Python Programming (PCAP-31-03) Exam Prep
- Class Variables, Instance Variables And __dict__ — PCAP Certified Associate in Python Programming (PCAP-31-03) Exam Prep
- Introspection: hasattr, __name__, __module__ And __bases__ — PCAP Certified Associate in Python Programming (PCAP-31-03) Exam Prep
- Inheritance, super() And Polymorphism — PCAP Certified Associate in Python Programming (PCAP-31-03) Exam Prep
- Object-Oriented Sprint — PCAP Certified Associate in Python Programming (PCAP-31-03) Exam Prep
- Twelve Traps, Mostly Objects — PCAP Certified Associate in Python Programming (PCAP-31-03) Exam Prep