On 3/13/2022 5:49 PM, joao.p.f.batista...@gmail.com wrote:
Currently:
l = [] # new empty list
t = () # new empty tuple
s = set() # new empty set (no clean and consistent way of initializing regarding the
others) <<<
d = {} # new empty dictionary
Possible solution:
s = {} # new empty set
d = {:} # new empty dictionary (the ":" is a reference to key-value pairs)
This is such a good idea that many people, including myself, have
already had it, and even more agree that this would be the proper way
for a new language. But as already discussed on python-ideas, this
change would break possibly millions of programs, and we will will not
do that. Please don't futilely push this further.
Current workaround at least for consistency:
l = list() # new empty list
t = tuple() # new empty tuple
s = set() # new empty set
d = dict() # new empty dictionary
Anyone who values consistency can pay the price of this in ones own code.
If you have questions, python-list would be the appropriate place.
--
Terry Jan Reedy
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at
https://mail.python.org/archives/list/python-dev@python.org/message/5XVT47A2AWGKM3BRJD27OD3I64IPEQ2N/
Code of Conduct: http://python.org/psf/codeofconduct/