Objects and Attributes
open, super, property, classmethod, staticmethod, isinstance, issubclass and the attribute helpers.
Easy
This is an overview — pick a sub-topic below.
Sub-topics (5)
open()
Opens a file and returns a file object; always use it with `with`.
Beginner♥ 0🔖 0💬 0
super()
Calls a method from the parent class (following the MRO).
Easy♥ 0🔖 0💬 0
classmethod and staticmethod
classmethod receives the class (alternative constructors); staticmethod receives nothing extra.
Easy♥ 0🔖 0💬 0
isinstance() and issubclass()
Check whether an object is an instance of a class (or tuple of classes), respecting inheritance.
Beginner♥ 0🔖 0💬 0
getattr(), setattr(), hasattr() and delattr()
Read, write, test and delete attributes by name at runtime.
Easy♥ 0🔖 0💬 0
Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.
Discussion (0)
Sign in or join free to ask questions and discuss this topic.