Last active
March 21, 2020 04:26
-
-
Save liladas/bd9e79d0cc78fb9608529c6dc00110a5 to your computer and use it in GitHub Desktop.
Python Property Verbose
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
class PurchaseOrder(): | |
""" PurchaseOrder - Models a Purchase made from market """ | |
def __init__(self, order_id: string): | |
super().__init__() | |
self._order_id = order_id | |
# defining a property | |
def order_id(): | |
doc = "The order_id property." | |
def fget(self): | |
return self._order_id | |
def fset(self, value): | |
self._order_id = value | |
def fdel(self): | |
del self._order_id | |
return locals() | |
order_id = property(**order_id()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment