This module add some useful features to Python inner classes :
class MyOuter:
@inner
class MyInner:
def hello(self):
print('Hello')
outer attribute
The inner class gain an 'outer' attribute that reference its outer class.
>>> MyOuter.MyInner.outer
<class '__main__.MyOuter'>
inner derivation
When the outer class is derived, the inner class is also derived in order to point at the derived outer class.
class MyChildOuter(MyOuter):
pass
>>> MyChildOuter.MyInner.outer
<class '__main__.MyChildOuter'>
carried inheritance
When the inner class is redefined in an outer subclass, it will automatically derivate from the inner class of the outer superclass.
class MyChildOuter(MyOuter):
class MyInner:
pass
>>> MyChildOuter.MyInner().hello()
Hello
inner instantiation
the outer attribute of an inner instance store it's outer instance
outer = MyOuter()
>>> outer
<__main__.MyOuter object at 0x03BAA990>
>>> outer.MyInner().outer
<__main__.MyOuter object at 0x03BAA990>
Metadata
Release files for inner-class 0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| inner-class-0.2.tar.gz | 3.4 kB | Details |
Release files / inner-class-0.2.tar.gz
| Download URL | inner-class-0.2.tar.gz |
|---|---|
| Size | 3.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f96f8c3a49c540c9986886dcf0808ec986e8c16b22b40bf821537378a66dbcc0
|
|
BLAKE2b-256 checksum How to use checksums |
c9e437e2ccb3883f1a76ade36f4fd00b1ad1e57d79038fc2b60db66f4a88afd7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.39.0 CPython/3.7.0
|