Friday Finking: initialising values and implied tuples

Rob Cliffe rob.cliffe at btinternet.com
Mon Apr 5 13:26:36 EDT 2021



On 05/04/2021 17:52, Chris Angelico wrote:
I don't understand.  What semantic difference could there be between
     x = { 1: 2 }    ;    y = [3, 4]   ;   z = (5, 6)
and
     x, y, z = { 1:2 }, [3, 4], (5, 6)
?  Why is it not safe to convert the latter to the former?
But I withdraw "set" from my "safe" list because I now realise that 
"set" could be reassigned.

Correction: set literals like {7,8} should still be OK as far as I can see.
Rob Cliffe


More information about the Python-list mailing list