Re: [Python-Dev] An unambiguous way of initializing an empty dictionary and set

March 13, 2022
10:01 p.m.
On 3/13/22 14:49, joao.p.f.batista.97@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)
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
However, it doesn't feel right to not be able to initialize an empty set as cleanly and consistently as lists, tuples and dictionaries in both forms.
This is a topic better fit to python-ideas. -- ~Ethan~
1197
Age (days ago)
1197
Last active (days ago)
0 comments
1 participants
participants (1)
-
Ethan Furman