Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Memento Pattern
#1
I'm wondering what the applicability of the Memento design pattern is in Python.

The intent of the pattern is to capture and externalise the internal state of an object without breaking encapsulation, so that the object can be restored to that state later. Implementation typically relies on being able to declare public and private methods/attributes on classes.

My question arises because in Python, it is only by convention that we consider an attribute/method to be private. Does the lack of language enforced visibility modifiers invalidate memento as a design pattern in Python, or is it sufficient to assume that potential clients will adhere to convention?
Reply


Messages In This Thread
Memento Pattern - by amb85 - Nov-25-2019, 01:20 PM
RE: Memento Pattern - by Larz60+ - Nov-25-2019, 04:25 PM
RE: Memento Pattern - by amb85 - Nov-25-2019, 04:44 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020