Created
February 12, 2022 11:39
-
-
Save StephenFordham/a36157ab4ef8150482d43661bbc47195 to your computer and use it in GitHub Desktop.
Unusual ways to control attrbute access in Python, Example 1
This file contains hidden or 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
emp = Employees('stephen', 'bournemouth', 30) | |
for key, value in emp.__dict__.items(): | |
print('{} = {}'.format(key, value)) | |
emp('Simon') | |
print('#####################################') | |
for key, value in emp.__dict__.items(): | |
print('{} = {}'.format(key, value)) | |
# Terminal Output | |
_name = stephen | |
_age = 30 | |
_location = bournemouth | |
##################################### | |
_name = Simon | |
_age = 30 | |
_location = bournemouth |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment