5 ms·
Maybe Guido doesn't like it because it looks weird when compared to the rest of Python's syntax? Still, I think it's cool. Having sets availably without importi
by sciencerobot 14y ago
Maybe Guido doesn't like it because it looks weird when compared to the rest of Python's syntax? Still, I think it's cool. Having sets availably without importing anything is one of the things I love about Python.
set = <> is still available.
- rdtsc 14y agoyou don't import sets , set() is available right away.
- jmmcd 14y agoset = <> is still available Did this get misformatted? I don't know what you mean.
- uraza 14y agoI believe sciencerobot is saying that "<>" could be used as the empty set literal.
- jmmcd 14y agoOh I see, thanks. "s=<>" is less ugly than "s={@}" but, obviously, is inconsistent with "s={1, 2, 3}".
- ekimekim 14y agoThen fix that: s = <1,2,3> I think that's better than using the same brace-type for sets and dicts anyway, and it can't be as confusing as () == tuple(), (x) == x, (x,) == tuple([x]).
- sciencerobot 14y agoYes, that was the idea. I don't think it would be confusing to the parser.
- uraza 14y agoset = <> looks like the other empty container literals, but it's not consistent with the literal notation for sets with one or more elements: my_set = {1,2,3}.
- sambe 14y agoWhat about supporting <1, 2, 3> as well, and eventually deprecating the existing way? The end result would be much nicer.