3 ms·
This article is only about primitive literals, not compound ones. I think the list and dict literals in Python are the #1 reason I like it better than C. I thin
by jmmcd 14y ago
This article is only about primitive literals, not compound ones. I think the list and dict literals in Python are the #1 reason I like it better than C. I think the regexp literals in Perl were one of the main reasons people liked Perl better than C.
- mahmud 14y agoThat line blurs when you have homoiconic syntax, specially one with a programmable reader. Common Lisp uses the # for dispatch macro character, you can define your own literals, in whatever environment you want. http://www.franz.com/support/documentation/6.2/ansicl/subsecti/sharpsig.htm http://www.franz.com/support/documentation/6.2/ansicl/subsec...
- pilgrim689 14y ago> I like [Python] better than C Isn't it strange to compare Python/Perl to C and say that one is better than the other? It's apples to oranges. You wouldn't use Python or Perl to build an OS, and you wouldn't use C to prototype a web app.
- jmmcd 14y agoSure, but I said "like", not "better". When I learned Python, I had that feeling described as weightlessness by xkcd [http://xkcd.com/353/ http://xkcd.com/353/], because I didn't have to write several lines and a loop to make a list. It made me happy. Fair comparisons don't really come into it.
- masklinn 14y ago> This article is only about primitive literals, not compound ones. It mentions array literals: http://www.gavilan.edu/csis/languages/literals.html#_Toc75870006 http://www.gavilan.edu/csis/languages/literals.html#_Toc7587...
- DerekL 14y agoC99 has array and struct literals: (int []) { 1, 2, 3 } (struct Point) { 3, 5 } (struct Point) { .x = 3, .y = 5 }