Skip to content

Files

Latest commit

 

History

History
26 lines (16 loc) · 506 Bytes

inherit-non-class.md

File metadata and controls

26 lines (16 loc) · 506 Bytes

Pattern: Inheritance from non-class

Issue: -

Description

Used when a class inherits from something which is not a class. Python will raise an exception on runtime and program will not execute.

Example of incorrect code:

class Bad(1): # [inherit-non-class]
    """ Can't inherit from instance. """

Example of correct code:

class Good(object):
    pass

Further Reading