* 2011-08-14T09:34:26+01:00 * Chris Angelico wrote: > Some day, I'd like to play around with a language where everything's > an expression and yet it doesn't look like LISP - just for the fun of > it. It probably won't be any more useful for real world coding, but > it'd be fun to tinker with.
Of course it's a useful feature. Basically you can put any Lisp code in the world in the place of a Lisp expression. (setf variable (handler-case (some-code) (foo-error () "value 1") (bar-error () "value 2"))) is something like variable = try: return some_code() except FooError: return "value 1" except BarError: return "value 2" Sure, it's not a necessary feature. All we need is the machine language, but other than that there are differences in how languages let programmers express themselves. The above example emphasizes that "'variable' is being assigned". The "how" part gets less weight. If we put the assignment inside the handler-case or try-except forms we get the same result technically but the variable assignment becomes more hidden and is repeated, possibly several times. I understand that Python philosophy does not value freedom of expression that much. It values a general Pythonic rule which must obeyed and is called "readability". Other languages give too little or too much freedom. :-) -- http://mail.python.org/mailman/listinfo/python-list