|
|
|
|
|
by hjk05
2549 days ago
|
|
> As for why, 0 is false, nonzero is true It’s not that clear cut. If you assign d[True] and then d[1] you overwrite because True hashes to 1, not because 1 is a truthy value. If you try writing to d[2] you don’t overwrite d[True]. In any case this Feels like an odd case where python is sort of doing something similar to implicit type conversion which goes against the zen of python. |
|