lang comparison: in-place algorithm for reversing a list in Perl,Python, Lisp

Xah Lee xahlee at
Thu Mar 1 23:04:10 CET 2012

On Mar 1, 7:04 am, Kaz Kylheku <k... at> wrote:
 (floor (/ x y)) --[rewrite]--> (floor x y)

Thanks for this interesting point.

I don't think it's a good lang design, more of a lang quirk.

similarly, in Python 2.x,
will work when both x and y are integers. Also,
works too, but that // is just perlish unreadable syntax quirk.

similarly, in perl, either one
require POSIX; floor(x/y);
the require POSIX instead of Math is a quirk. But even, floor should
really be builtin.
using a perl hack

all of the above are quirks. They rely on computer engineering by-
products (such as int), or rely on the lang's idiosyncrasy. One easy
way to measure it is whether a programer can read and understand a
program without having to delve into its idiosyncrasies. Problem with
these lang idioms is that it's harder to understand, and whatever
advantage/optimization they provide is microscopic and temporary.

best is really floor(x/y).

idiomatic programing, is a bad thing. It was spread by perl, of
course, in the 1990s. Idiomatic lang, i.e. lang with huge number of
bizarre idioms, such as perl, is the worst.


More information about the Python-list mailing list