"I thought {@} would be a good for an empty set because it arguably looks like the empty set symbol"
I'm just nitpicking but I don't think this is a good justification - If the @ symbol looks like the empty set symbol, then {@} is the set containing the empty set
I personally prefer dict() to {} anyway, so I don't really miss the lack of an empty set literal.
Adding a set literal was a slippery slope anyway. Where's my frozenset literal? Where's my namedtuple literal?
(I also don't particularly like the {} syntax for dicts, because there is {'too_much': 'quoting'} which I find rather ugly. I much prefer dict(too_much='quoting') or, even better, Perl's solution: { too_much => 'quoting' }.)
You're right on trusting the core developers, but "for a reason" type arguments are not the way to do things. I love Python because it's so practical and manages to stop codebases from devolving into overengineered incomprehensible messes, but I hate tons lots of things about it, and more generally I hate its "worse is better" approach (http://www.jwz.org/doc/worse-is-better.html) to many things (because for Guido, if "worse" is "simpler to explain and implement", he always chooses it, always implementation simplicity over nice "interface" features and also over "interface" consistency... I almost want to shoot the man when I read arguments like http://www.artima.com/weblogs/viewpost.jsp?thread=147358 coming from a very smart person like him). OP's complaint is valid imho, consistency is f important, because small inconsistencies pile up and make a language harder to learn (yeah, you don't notice them once they're in your "muscle memory", but "learnability" is important for a language and this is why I like Python and I hope it doesn't lose this quality by slowly accreting inconsistencies). Hopefully his blogpost is a message that reaches Guido and the core developers and nudges them even a little bit towards a better path!
I just wish someone could find the old discussions...
The main argument I could see against empty set literals was how wrong it felt adding it to the grammar. Even adding 3 lines of code for the feature, felt like it was just creating chaos in a zen-like codebase.
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 = <> 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}.
The webfont doesn't load for me because I have Ghostery installed (it blocks remote tracking scripts) so the page is all blank except for the code snippets (because Adobe Typekit is blocked). You should consider adding a fallback font.
I vaguely recall seeing a mailing list thread where `{-}` was proposed. I think it was rejected based on parsing ambiguity, i.e. `{-1}` vs `{-}`. (Or it's possible I might be losing my memory)
What, you've never gone and hacked an interpreter because you were mildly annoyed by something? I don't think he actually means for it to be used in production.
[+] [-] rakha|13 years ago|reply
I'm just nitpicking but I don't think this is a good justification - If the @ symbol looks like the empty set symbol, then {@} is the set containing the empty set
[+] [-] jrockway|13 years ago|reply
Adding a set literal was a slippery slope anyway. Where's my frozenset literal? Where's my namedtuple literal?
(I also don't particularly like the {} syntax for dicts, because there is {'too_much': 'quoting'} which I find rather ugly. I much prefer dict(too_much='quoting') or, even better, Perl's solution: { too_much => 'quoting' }.)
[+] [-] mkhattab|13 years ago|reply
[+] [-] raymondh|13 years ago|reply
Really, you should trust the core developers on this one. Empty set literals are missing from Python for a reason.
[+] [-] nnq|13 years ago|reply
[+] [-] philipbjorge|13 years ago|reply
The main argument I could see against empty set literals was how wrong it felt adding it to the grammar. Even adding 3 lines of code for the feature, felt like it was just creating chaos in a zen-like codebase.
[+] [-] polemic|13 years ago|reply
[+] [-] derefr|13 years ago|reply
[+] [-] Erwin|13 years ago|reply
[+] [-] hwiechers|13 years ago|reply
[+] [-] sciencerobot|13 years ago|reply
set = <> is still available.
[+] [-] jmmcd|13 years ago|reply
Did this get misformatted? I don't know what you mean.
[+] [-] uraza|13 years ago|reply
[+] [-] rdtsc|13 years ago|reply
[+] [-] codesuela|13 years ago|reply
[+] [-] philipbjorge|13 years ago|reply
I just added a 1 second timeout that puts a default font on if the webfont hasn't loaded. Just tested with ghostery and it should be good to go.
[+] [-] vbtemp|13 years ago|reply
Should be, it's not always hard to make interesting changes to very well-designed and well-architected projects
[+] [-] johnsoft|13 years ago|reply
[+] [-] yen223|13 years ago|reply
[+] [-] philipbjorge|13 years ago|reply
[+] [-] tantalor|13 years ago|reply
[+] [-] dechols|13 years ago|reply
list() or []
dict() or {}
set() or ????
I would argue that the left is more pythonic and expressive.
[+] [-] SilasX|13 years ago|reply
[+] [-] npc|13 years ago|reply