Skip to content

tre-x/python-get-outer-class-from-inner-class

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

Accessing an outer class from an inner class in Python

From my answer over at https://stackoverflow.com/a/60908562/8142307

An excerpt describing the scenario:

An example of this scenario could be having a class with sub-classes that need to access the outer class, as normal, but then needing to create another class (top level) derived from the first class. In that case, the second class's sub-classes would try to access the parent using self.<original_parent_name> and get the original class, not the new class that they are a sub-class from. I hope people reading this can visualise this difficult scenario and see the point of questions like this

Releases

No releases published

Packages

No packages published

Languages