I know that private attributes are loosely defined in Python, but I'm trying to figure out what would be the most lean way of implementing a method to merge together private attributes.
Class Event:
target_time: datetime
_names: set
I'm thinking of having a static method to merge together two Events.
@staticmethod
def merge(event1: Event, event2: Event) -> Event:
new_event = Event()
new_event = event1._names + event2._names
return new_event
But I'm unsure if this breaks some good design patterns about private attribute since they are private.
Aucun commentaire:
Enregistrer un commentaire