SNEWS2 / SNEWS_Publishing_Tools

Publishing Tool for SNEWS
BSD 3-Clause "New" or "Revised" License
2 stars 2 forks source link

nested method #28

Closed Storreslara closed 2 years ago

Storreslara commented 2 years ago

Shouldn't this method be defined in the class rather than defined inside tier_decider . Every time tier_decider is called append message will be redefined. Seems inefficient

https://github.com/SNEWS2/SNEWS_Publishing_Tools/blob/40301467bfd1df011e470f201361f5d3acbd0a79/SNEWS_PT/snews_pt_utils.py#L289

KaraMelih commented 2 years ago

Right, actually that function uses several more arguments like data, meta, schema and function itself is used several times within the _tier_decider so once the tier decider is called, _append_messages is also defined once, and until it appends all the messages it uses these data, meta, schema from the "global" (well, it is local to _append_messages) so I thought this may even be more efficient