41 points · by philipbjorge · 13y ago · 46 comments
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
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' }.)
I agree, but if it wasn't for the fact that using dict() is six times slower than using literals then it wouldn't make much of a difference arguing code style [1].
> (By that logic, you should represent sets as {'element': 1} instead of set('element'), because calling the function "set" is slower than making a dictionary object from the special syntax.)
Which is why I guess there are now set literals in Python (just not for empty sets :).
-- [1]: http://doughellmann.com/2012/11/the-performance-impact-of-us...
Really, you should trust the core developers on this one. Empty set literals are missing from Python for a reason.
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.
dict() = {}
set() = <>
tuple() = ()
list() = []
(btw, does anyone actually use `<>` as `!=`?) x = 【1, 2, 3】
y = 【】
;)Of course `<1, 2, 3, 4>` would then have to be an alternative set literal.
<pedant type="confused">emphatic?</pedant>set = <> is still available.
Did this get misformatted? I don't know what you mean.
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.
Should be, it's not always hard to make interesting changes to very well-designed and well-architected projects
dict: {}
list: []
tuple: ()
set: {-} There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.