Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

13
  • 4
    There's no reason to redefine Results_Data for every instance of Evolution_Base: just define it globally. Commented Jan 11, 2023 at 1:58
  • 1
    Show the expected input (df_1, df_2) and output. Commented Jan 12, 2023 at 0:57
  • 2
    Kind of a sidenote, but I doubt you actually want to specify property_list = [] as a mutable default argument. Perhaps you meant property_list: list? Commented Jan 12, 2023 at 4:01
  • 1
    I don't know your use case, so this might be a stupid question, but is there a reason you don't define the change-getting method on Value_Difference, if that's the route by which you want to access it? If it's the main thing you're using Value_Difference for and you don't want t keep typing a method name, you could even define it as __call__. Then it would be as simple as evolution.difference('xyz'). Commented Jan 13, 2023 at 21:39
  • 2
    @keynesiancross can you explain why do you want to do it? In my opinion, using python to dynamically set attributes on a class causes a lot of maintenance problems for the code base, and I would really think to reconsider if you want to do this. For example, you can create all possible properties (assuming it's a defined list), and make them return None or some other indication for no-difference. It will also create a much more clear api for those who interact with this class, so they won't get possible AttributeErrors in the future Commented Jan 15, 2023 at 16:54