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

2022-04-06 Thread Brian McCall
> Unfortunately, Python simply doesn't have enough symbols available. > Using precisely one opener/closer for each type is highly limiting, > since the only characters available are those on a US-English keyboard > and in the ASCII set. It would be nice if, for instance, ∅ could mean > "new empty

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

2022-03-17 Thread Chris Angelico
On Fri, 18 Mar 2022 at 00:31, David Mertz, Ph.D. wrote: > > I just do this myself in my text editor (vim): > > > But this is just cosmetic because I like to look at it this way. The actual > file on disk contains `set()`, `<=`, `in`, `not in` and wouldn't be a problem > for anyone without the

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

2022-03-17 Thread David Mertz, Ph.D.
I just do this myself in my text editor (vim): [image: sets-py.png] But this is just cosmetic because I like to look at it this way. The actual file on disk contains `set()`, `<=`, `in`, `not in` and wouldn't be a problem for anyone without the same fonts installed, or require anyone to know odd

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

2022-03-17 Thread Chris Angelico
On Thu, 17 Mar 2022 at 23:19, Stéfane Fermigier wrote: > > The “correct” (according to Bourbaki) mathematical notation for an empty set > is “∅" (aka Unicode U+2205, or HTML ) > > Some time ago, for a project which had a lot of empty sets, I tried to use > this symbol as a short hand for set().

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

2022-03-17 Thread Michael Smith
Hmm, I think the idea of the mathematical symbol is interesting, but I think users are more interested in constructing a new, eventually-not-empty set, than referencing the empty set. Semantically, I don't know if ∅() is satisfying. On Thu, Mar 17, 2022 at 08:19 Stéfane Fermigier wrote: > The

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

2022-03-17 Thread Stéfane Fermigier
The “correct” (according to Bourbaki) mathematical notation for an empty set is “∅" (aka Unicode U+2205, or HTML ) Some time ago, for a project which had a lot of empty sets, I tried to use this symbol as a short hand for set(). But: >>> ⦰ = set() File "", line 1 ⦰ = set() ^

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

2022-03-17 Thread Serhiy Storchaka
14.03.22 15:07, Joao S. O. Bueno пише: - but what about keeping what exists and adding {,}  for an empty set? (it is not that unlike the one-element tuple, which already exists) If you want to create an empty set without using any identifier, use {*()}. The advantage is that it works in old

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

2022-03-14 Thread Joao S. O. Bueno
Do you know what else would work for being able to enter empty sets? A prefix to {} , like "s" a = s{} and b = f{} for an empty frozenset (/me ducks, and hides in a place Chris won't find me) On Mon, Mar 14, 2022 at 10:29 AM Chris Angelico wrote: > On Tue, 15 Mar 2022 at 00:07, Joao S. O.

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

2022-03-14 Thread Chris Angelico
On Tue, 15 Mar 2022 at 00:07, Joao S. O. Bueno wrote: > > > > On Mon, Mar 14, 2022 at 9:49 AM Chris Angelico wrote: >> >> On Mon, 14 Mar 2022 at 23:35, wrote: >> > >> > Currently: >> > l = [] # new empty list >> > t = () # new empty tuple >> > s = set() # new empty set (no clean and consistent

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

2022-03-14 Thread Joao S. O. Bueno
On Mon, Mar 14, 2022 at 9:49 AM Chris Angelico wrote: > On Mon, 14 Mar 2022 at 23:35, 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

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

2022-03-14 Thread David Mertz, Ph.D.
On Mon, Mar 14, 2022 at 8:33 AM wrote: > Possible solution: > s = {} # new empty set > d = {:} # new empty dictionary (the ":" is a reference to key-value pairs) > I have suggested over the years—as have probably dozens of other people (maybe thousands)—that that would be a great spelling if

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

2022-03-14 Thread Chris Angelico
On Mon, 14 Mar 2022 at 23:35, 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 = {:}