Created
May 22, 2023 17:36
-
-
Save rongpenl/03b8d654dad1a1e9bbfb64124a322fb9 to your computer and use it in GitHub Desktop.
Python integers are immutable.
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
""" | |
hollyandprosper.com | |
YouTube Channel: https://www.youtube.com/@hollyandprosper | |
Link to the original YouTube Short: https://youtu.be/Oo2g93efAeQ | |
""" | |
alpha = 'alpha' | |
# alpha[0] = 'A' | |
answer = 42 | |
print(id(answer)) | |
answer += 1 | |
print(id(answer)) | |
# Advantages of immutability | |
# potentially faster | |
# can be hashed | |
# safer for multithreading |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment