[Python-ideas] Backward-incompatible changes for Python 4
Greg Ewing
greg.ewing at canterbury.ac.nz
Mon Apr 1 17:43:19 EDT 2019
Paul Moore wrote:
> now that Python has type
> inference, it should be possible for users to just type {} and have
> the interpreter work out which was intended from context.
Or have {} return an ambiguous object that turns into a dict or
set depending on what is done to it.
We could call it a quict (quantum dict).
To support this, we would also have to add a third possible
value for type bool:
>>> x = {}
>>> isinstance(x, dict)
Maybe
>>> isinstance(x, set)
Maybe
>>> x['foo'] = 42
>>> isinstance(x, dict)
True
>>> isinstance(x, set)
False
--
Greg
More information about the Python-ideas
mailing list