Download our e-book of Introduction To Python
Pallavi Dhotre
3 years ago
@property
def place(self):
return self._place
@place.setter
def place(self, placeName):
if placeName not in ['Rome','France','Los Angeles ']:
self._place = 'Bangkok'
print('Not a Destination')
else:
self._place = placeName
print('Your Destination is here')
#python decorator examples
class Destination:
def __init__(self, place):
self.place=place
@property
def place(self):
return self._place
@place.setter
def place(self, placeName):
if placeName not in ['Rome','France','Los Angeles ']:
self._place = 'Bangkok'
print('Not a Destination')
else:
self._place = placeName
print('Your Destination is here')
d = Destination('Rome')