Try this in an interactive python shell.
[] is [ ]
The above returns False, why?
The ==
operator compares the values of both the operands and checks for value equality. Whereas is
operator checks whether both the operands refer to the same object or not.
id('') : 139634828889200
id('') : 139634828889200
id('') : 139634828889200
id([]) : 139634689473416
id([]) : 139634689054536
id([]) : 139634742570824