Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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)


Wouldn't it lead to the same problem of a lack of consistency?

    dict: {} 
    list: []
    tuple: ()
    set: {-}


I originally implemented it that way and had that exact same issue (it's one of the revisions on github). Similarly, {/} would also be a problem.


How about {,} or s{} ?


I think {,} is intuitive because it reminds me of syntax for one-element tuples, e.g. (1,) -- but it may make code harder to read, which is not Pythonic.


I didn't think to do {,} which I like. s{} looks weird to me, but I couldn't tell you why.


The s{} alternatve is based on the strange r'' or u'' syntax i've gotten used to.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: