[issue19462] Add remove_argument() method to argparse.ArgumentParser

2020-03-23 Thread Alexander Hirner
Alexander Hirner added the comment: @paul j3 FWIW, popping optionals from a cache that is maintained in addition to self._actions, makes special conflict handling unnecessary. i.e.: for option_string in a.option_strings: parser._option_string_actions.pop(option_string

[issue39134] can't construct dataclass as ABC (or runtime check as data protocol)

2020-01-18 Thread Alexander Hirner
Alexander Hirner added the comment: In that case, what should the getter return? It doesn't know about the implementation of x. Maybe I'm not getting the idea behind adding getters/setters. -- ___ Python tracker <https://bugs.python.

[issue39134] can't construct dataclass as ABC (or runtime check as data protocol)

2020-01-02 Thread Alexander Hirner
Alexander Hirner added the comment: This results in E(x=None). I'd need to look into that to understand why. -- Added file: https://bugs.python.org/file48817/dc2_repro.py ___ Python tracker <https://bugs.python.org/issue39

[issue39134] can't construct dataclass as ABC (or runtime check as data protocol)

2020-01-01 Thread Alexander Hirner
Alexander Hirner added the comment: Dropping ABCMeta stops at instantiation. This should be in the dataclass code that's been generated. File "", line 2, in __init__ AttributeError: can't set attribute Repro: ``` class QuasiABC: @property @abstractmethod def x(se

[issue39134] can't construct dataclass as ABC (or runtime check as data protocol)

2019-12-28 Thread Alexander Hirner
Alexander Hirner added the comment: We construct a computational graph and need to validate (or search for possible new) edges at runtime. The data is specific to computer vision. One example is clipping geometry within 2D boundaries. A minimal implementation of this data would

[issue39134] can't construct dataclass as ABC (or runtime check as data protocol)

2019-12-27 Thread Alexander Hirner
Alexander Hirner added the comment: Pardon my sloppiness. 1. That should have been PEP 544. The last point referred to the notion of data protocols [0]. 2. I think solving this issue for dataclasses would ensure better composition with modern libraries and other idioms like Protocol

[issue39134] can't construct dataclass as ABC (or runtime check as data protocol)

2019-12-26 Thread Alexander Hirner
Alexander Hirner added the comment: Here, nothing but less boiler plate. Wouldn't it pay off to not rewrite dataclass features like frozen, replace, runtime refelection and the ability to use dataclass aware serialization libraries (e.g. pydantic)? I think @dataclass+@abstractproperty

[issue39134] can't construct dataclass as ABC (or runtime check as data protocol)

2019-12-25 Thread Alexander Hirner
New submission from Alexander Hirner : At runtime, we want to check whether objects adhere to a data protocol. This is not possible due to problematic interactions between ABC and @dataclass. The attached file tests all relevant yet impossible cases. Those are: 1) A(object): Can't check due