[perl-python] 20050211 generating expression by nested loops

Michael Sparks zathras at thwackety.com
Sat Feb 12 07:51:21 EST 2005


On 11 Feb 2005, Xah Lee wrote:

> # this construct uses a irregular syntax to generate a expression
> # built by nested loops.  Semantically, this expression generation is
> # akin to applying a function to a tree. Morons in the computing
> # industry and academia like to call this "list comprehension".

People who try to change existing terminology in a language by declaring
the terminology used by __everyone__ are generally those considered
moronic.

Xah Lee - I know you have been declared a Troll on many an occasion, and
it does seem a fitting declaration based on your behaviour. Consider that
all you are achieving is making yourself look foolish to both the
established perl community and the established python communities.

Your code examples are NOT exemplars for either language or community. By
trying to get new users to ignore existing terminology you ARE doing those
people a disservice. (If indeed your goal is as stated to try and help new
users).

Taking 'list comprehension' for example. There is a long standing concept
that is decades old (centuries old even?) called "set comprehension".
This is taught in schools and says "from this set of things take these
values perhaps based on a condition". List comprehension alludes to this
and as soon as I saw the syntax and what it was called it was very clear
what this "moronic" description meant.

Clearly not everyone is in the same boat. However what will they search
for? If told it's a "list comprehension", suppose they search for that -
what will their #1 search result be? On google, the number 1 result is
this:
   http://docs.python.org/tut/node7.html
   * This is the python tutorial section that deals with data structures
     and includes a section on "moronically named" list comprehensions.
     One can debate whether naming something distinctly and clearly which
     results in the #1 search result being a tutorial on the structure as
     being a good or a bad thing. I'll make no judgement here.

So by trying to get people to call it something else - do new users get
better results ? If you were doing new users a service then the answer
should be yes. Is it, and are you doing them a service?

Let's try the same thing for "irregular syntax":
   * http://www.google.com/search?num=100&q=irregular+syntax
     None of these 100 results contains any reference to list
     comprehensions. Not so successful. None of the 3 results out of that
     100 that do relate to python refer even vaguely to python's list
     syntax. (2 relate to a scheme programmer finding python hard, and the
     other relates to Latin)

Well, you also incorrectly (or perhaps misleadingly) stated this:
   * Semantically, this expression generation is akin to applying a
     function to a tree.

If you provide an iterator on the tree (say a tree walker of some kind)
then this becomes technically true (__kinda__) , but the common case is
iterating over list of somekind. So again, assuming a new user, what might
they use as a search term using your description ? Let's try "applying a
function to a tree python". (last term to try and ensure it's on topic)

Do any of those search results do something as useful as, say, point at a
tutorial or documentation page on list comprehensions ?

Oddly no. The closest that comes to it is one of your pages, which is
taling about Perl & Mathematica. (Removing "python" makes it even further
removed from being relevant)

Based on seeing your perl and python code I would suggest you go away and
improve your idiomatic perl & python code before posting any more of these
things. Or at least try to cease attacking people declaring their
established terminology as moronic, etc. Posting naive translations
(which is what you've been doing) between languages can occasionally
be useful to help people get started. However acting as if they are
"masterful" translations and/or descriptions when they are not is not
helpful in the slightest.

It's very saddening to see something posted which new users will read and
assume, based on the tone on the post, that it's the _correct_ way of
describing things when it clearly is NOT, and will just end up misleading
them and sending them down blind alleys.


Michael.




More information about the Python-list mailing list