Skip to main content

All Questions

Tagged with
0 votes
1 answer
188 views

How to invoke default methods with attrs python package

All, Thank you for taking the time to try and address my question. My question is related to a specific Python package called attrs (https://www.attrs.org/en/stable/). I am just getting started with ...
UGuntupalli's user avatar
2 votes
3 answers
674 views

Creating Python class with mutually exclusive arguments using attrs

I have a class that has two mutually exclusive arguments (prices and returns). That is, they must not be both provided in order to instantiate an object. However, the class needs both for internal ...
Andi's user avatar
  • 4,001
36 votes
4 answers
39k views

Setting default/empty attributes for user classes in __init__ [closed]

When I am creating a new class, should I set all instance attributes in __init__, even if they are None and in fact later assigned values in class methods? See example below for the attribute results ...
Andy's user avatar
  • 1,056
1 vote
2 answers
626 views

Storing passed data in object twice with `attrs` package

I am creating a data provider class that will hold data, perform transformations and make it available to other classes. If the user creates and instance of this class and passes some data at ...
n1k31t4's user avatar
  • 2,804