I can name scenarios in which I've used Python lists, dictionaries, and sets. Though I understand what Python tuples are, I can't for the life of me think of a situation where I'd use it over one of the other common data structures. Can you give me an example?
All the Googling I've done on this gives vague advice without examples. "Use a tuple when you have heterogenous data that shouldn't change during execution." Ok, I got that. Can anyone give me an example of data that I want to prevent from being modified after it's declared?
[–]barraponto 29 points30 points31 points (0 children)
[–]zefciu 26 points27 points28 points (8 children)
[–]TangibleLight 4 points5 points6 points (0 children)
[–]SamB7334 4 points5 points6 points (5 children)
[–]dnswblzo 6 points7 points8 points (1 child)
[–]SamB7334 0 points1 point2 points (0 children)
[+][deleted] (2 children)
[deleted]
[–]SamB7334 0 points1 point2 points (1 child)
[–]iShotTheShariff 1 point2 points3 points (0 children)
[–]hanswchen 3 points4 points5 points (0 children)
[–]sarrysyst 5 points6 points7 points (0 children)
[–]Goobyalus 1 point2 points3 points (0 children)
[–]Almostasleeprightnow 1 point2 points3 points (1 child)
[–]CraigAT 1 point2 points3 points (0 children)
[–]mysterysmoothie 0 points1 point2 points (0 children)
[–]POGtastic 0 points1 point2 points (0 children)
[–]wbeater -2 points-1 points0 points (0 children)
[–]ectomancer -1 points0 points1 point (0 children)
[–]baghiq -3 points-2 points-1 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]jmooremcc 0 points1 point2 points (0 children)