Skip to content

Instantly share code, notes, and snippets.

@tushar4303
Last active June 8, 2022 08:28
Show Gist options
  • Save tushar4303/7735d7bc559c5063e085bcffc02b50a7 to your computer and use it in GitHub Desktop.
Save tushar4303/7735d7bc559c5063e085bcffc02b50a7 to your computer and use it in GitHub Desktop.
Imp points to be noted in python
----------------------------------------------------------------------------------
Python Notes
----------------------------------------------------------------------------------
#when you equate a list to a new list, it doesn't actually copy the list
but instead points to the locations in your original list thus any changes
made in the new list reflects in the old one as well
my_list = your_list
#to avoid this do:
my_list = your_list[:] or my_list = your_list.copy()
------------------------------------------------------------------------------------
#dictionary key can be a tuple, string, number but not a list, because lists are
mutable and dictionary doesn't like the key to change
------------------------------------------------------------------------------------
python doesn't support i++ or i---
but does support i += 1, etc
------------------------------------------------------------------------------------
END
----------------------------------------------------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment