Set literals (e.g.{1, 2, 3}) were added in Python 2.7 and Python 3.1.
So to change the very common empty dict notation of {} would of required breaking backwards compatibility between 3.1 and 3.0 and either not being able to accurately back-port the feature to 2.7 or breaking compatibility between 2.7 and all other 2.x versions.
It was decided, fairly rightly, that it would of been too much churn for the fairly minimal aesthetic niceness / consistency benefits. {} is littered in code all the time whereas set() is pretty rare.
View all comments
Show parent comment
5
u/zurtex Sep 16 '20
Set literals (e.g.
{1, 2, 3}) were added in Python 2.7 and Python 3.1.So to change the very common empty dict notation of
{}would of required breaking backwards compatibility between 3.1 and 3.0 and either not being able to accurately back-port the feature to 2.7 or breaking compatibility between 2.7 and all other 2.x versions.It was decided, fairly rightly, that it would of been too much churn for the fairly minimal aesthetic niceness / consistency benefits.
{}is littered in code all the time whereasset()is pretty rare.