Python Tip #python #programming #developer #programmer #coding #coder #softwaredeveloper #computerscience #webdev #webdeveloper #webdevelopment #pythonprogramming #pythonquiz #ai #ml #machinelearning #datascience
I don’t agree with saying .get is always the correct way. Using [] is valid when you want an exception if the key is missing, depending on your specific needs.
While using .get() in Python is excellent for handling missing dictionary keys, it’s not the only ‘right way.’ Square brackets are fine if you're sure the key exists and want a KeyError. Don't buy into dogma—this isn't Go, where there’s only 'the Go way.'
ya the get method won't give any err if the key is not present in the obj
hunter python ninjas become web3 legends embrace the future
United States Trendler
- 1. Lakers 75.5K posts
- 2. #Talus_Labs N/A
- 3. Wemby 26.3K posts
- 4. Luka 68.3K posts
- 5. Marcus 31.5K posts
- 6. #LakeShow 5,634 posts
- 7. Blazers 8,532 posts
- 8. Russ 10.6K posts
- 9. Ayton 15.9K posts
- 10. #AmphoreusStamp 6,717 posts
- 11. Horford 1,994 posts
- 12. Richard 45.2K posts
- 13. #RipCity N/A
- 14. #dispatch 63.3K posts
- 15. Thunder 36.4K posts
- 16. Godzilla 33.6K posts
- 17. Podz 2,413 posts
- 18. Kuminga 3,348 posts
- 19. Nico Harrison 1,834 posts
- 20. Spencer Knight N/A
Something went wrong.
Something went wrong.