This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Consider adding decorator for required inner class
Type: enhancement Stage:
Components: Library (Lib) Versions:
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Elijah Rippeth
Priority: normal Keywords:

Created on 2020-05-23 23:07 by Elijah Rippeth, last changed 2022-04-11 14:59 by admin.

Messages (1)
msg369756 - (view) Author: Elijah Rippeth (Elijah Rippeth) * Date: 2020-05-23 23:07
Sometimes it's desirable to couple classes together by nesting. Currently there's no way to signal to an interface implementer that an inner class is a required attribute to be implemented. 

I propose a decorator for `abstractnestedclass` to fill this gap. A simple example use-case is outlined below:

```
from abc import ABCMeta, abstractnestedclass

class BaseComponent(metaclass=ABCMeta):
    @abstractnestedclass
    class Config:
        pass

class MissingNestedComponent(BaseComponent):
    # This will raise when constructed because 
    # BaseComponent.Config is not implemented
    pass

class NonraisingComponent(BaseComponent):
    # This will be constructable
    class NonraisingComponentConfig(BaseComponent.Config):
        pass
    pass
```
History
Date User Action Args
2022-04-11 14:59:31adminsetgithub: 84926
2020-05-23 23:07:34Elijah Rippethcreate