- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Do you think Python Dictionary is really Mutable?
Yes, Python Dictionary is mutable. Changing references to keys doesn't lead to the creation of new dictionaries. Rather it updates the current dictionary in place.
example
a = {'foo': 1, 'bar': 12} b = a b['foo'] = 20 print(a) print(b)
Output
This will give the output −
{'foo': 20, 'bar': 12} {'foo': 20, 'bar': 12}
Advertisements
To Continue Learning Please Login
Login with Google