Last active
November 23, 2016 17:00
-
-
Save justinfay/8d17ecd58befe9524e8d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def private(): | |
""" | |
Factory function for creating Private instances. | |
""" | |
def _(): | |
_.attr = 0 | |
class Private(object): | |
""" | |
class with one private attribute and method to increment. | |
""" | |
@property | |
def attr(self): | |
return _.attr | |
def add_one(self): | |
_.attr += 1 | |
return Private() | |
return _() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment