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.

Title: Consider adding decorator for required inner class
Type: enhancement Stage:
Components: Library (Lib) Versions:
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):
    class Config:

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

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