Closed omrihaber closed 1 year ago
Thanks for the feature proposal! The bar for having new ideas accepted into the stdlib is quite high, however, so ideas like this need to be discussed at https://discuss.python.org/c/ideas/6 before opening an issue here. Once it's been discussed there for a while, if the idea has a reasonable level of support, we can potentially reopen this issue.
@AlexWaygood ty!, I will open a topic for discussion there.
Feature or enhancement
When creating a factory (class that conforms to some abstract class and instantiates subclasses by providing some distinguishing attribute).
*written code I'm not sure will work as is but to indicate the idea why such syntactic sugar will be useful. Current implementation iv'e encountered when implementing this behaviour in python:
Pitch
Required input: Abstract class interface Distinguishing keys mapping/list(keys that map to constructors)
Desired output: Class that recieves the distinguishing attribute and its constructor passes its arguments to the mapped constructor.
example interface in python:
Previous discussion