[Python-ideas] Re: Should dataclass init call super?

2020-04-14 Thread Christopher Barker
On Tue, Apr 14, 2020 at 7:46 PM Ricky Teachey wrote: > For simple situations you can call super in the __post_init__ method and > things will work fine: > But not for the OP's case: he wanted to pass extra parameters in -- and the dataclass' __init__ won't accept extra arguments. -CHB > clas

[Python-ideas] Re: Should dataclass init call super?

2020-04-14 Thread Wes Turner
Could there be a self.super that defaults to true; but could be set to a callable? On Tue, Apr 14, 2020, 10:47 PM Ricky Teachey wrote: > For simple situations you can call super in the __post_init__ method and > things will work fine: > > class BaseClass: > def __init__(self): > prin

[Python-ideas] Re: Should dataclass init call super?

2020-04-14 Thread Ricky Teachey
For simple situations you can call super in the __post_init__ method and things will work fine: class BaseClass: def __init__(self): print("class BaseClass") @dataclass class DataClass(BaseClass): def __post_init__(self): super().__init__() print("class DataClass")

[Python-ideas] Re: Should dataclass init call super?

2020-04-14 Thread Christopher Barker
On Mon, Apr 13, 2020 at 9:22 PM Neil Girdhar wrote: > Cool, thanks for doing the relevant research. > For my part, I'd like to see an aeefort to move dataclasses forward. Now that they are in the standard library, they do need to remain pretty stable, but there's still room for extending them. B

[Python-ideas] Re: Proposed class for collections: dynamicdict

2020-04-14 Thread Steele Farnsworth
I've implemented the class as a stand-alone module here: https://github.com/swfarnsworth/dynamicdict It could in theory be made significantly more concise if `defdict_type` were the base for this class instead of `PyDict_Type`. On Tue, Apr 14, 2020 at 1:32 PM Andrew Barnert via Python-ideas < p

[Python-ideas] Re: Proposed class for collections: dynamicdict

2020-04-14 Thread Andrew Barnert via Python-ideas
> On Apr 13, 2020, at 18:44, Caleb Donovick wrote: >  > I have built this data structure countless times. So I am in favor. Maybe you can give a concrete example of what you need it for, then? I think that would really help the proposal. Especially if your example needs a per-instance rather t