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

As contrived as those examples are, Python does have one feature that I currently miss, which is that trailing commas are ignored.

  mylist = [
    "ape",
    "bat",
    "cat",
           ]


If you'd like trailing commas in your JavaScript, one of the tiny things that CoffeeScript does is allow trailing commas, or for commas to be omitted altogether on multi-line array and object literals.

    list: [
      "ape",
      "bat",
    ]

    list: [
      "ape"
      "bat"
    ]
.. are the same.


And in Clojure, all commas everywhere are whitespace. You can use them, or not use them, even on single line expressions.

(list a b c) == (list a, b, c) == (list a b, c)


This feature is also in C and in Go language. It makes especially easy to write code generators, because you don't have to deal with first/last special cases.


I love this feature, but it bites me in the ass every time I work in a language that doesn't support this - like javascript and SQL.




Consider applying for YC's Winter 2027 batch! Applications are open till November 2.

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

Search: