Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

Chris Angelico rosuav at gmail.com
Thu Mar 27 12:10:00 EDT 2014


On Fri, Mar 28, 2014 at 2:44 AM, Mark H Harris <harrismh777 at gmail.com> wrote:
> My comments here are not in the least hasty, nor are they generalizations.
> They are based on long years of experience with "normal" users, personal
> programming experience for almost 40 years, and insight into student
> perception from reader comment forms, evaluations, personal discussions.
> (sometimes from this list mind you)

There is no such thing as a normal user, especially not of a
programming language. When you're writing something for a particular
class of person, you might be able to talk about the "normal user";
for instance, a word processor is most likely to be used by people who
have documents to edit, but who are not trying to do major
manipulation of a photo. Adding a caption to a photo and printing it,
maybe, but for heavy manipulation, you should be turning to something
like Gimp, so that's not part of what a normal user will be doing. You
can expect that the "normal user" of Star/Open/Libre Office's word
processor is going to be broadly familiar with page layout terms like
"header" and "footer" (or can learn such terms), and will quite
possibly understand the concept of "widows", but won't necessarily
understand, for instance, the difference between a bitmapped font and
a vector font.

But with programming languages, who's the "normal user"? Maybe there
are a few really REALLY specific-purpose languages that have the same
expectations on their users as the above example, but a
general-purpose language like Python is used by many sorts of people.
There are expert programmers who've used the language since pre 2.0
(hi Steven!); there are experienced programmers who, while not having
decades of experience with Python, do at least have an extremely solid
understanding of programming (that's where I'd put myself), with any
of several backgrounds; some have strong non-programming backgrounds
(maybe mathematical or scientific), and understand the rigors but not
necessarily the syntax (look at the recent discussion threads on
python-ideas about introducing an @ operator); there are business
people who just want to get things done; there are sysadmins or
network admins who usually use other people's tools but dabble in a
bit of scripting themselves; there are students who've just come out
of a basic Comp Sci class; and this is hardly an exhaustive list.
Every one of those people has a different set of preconceptions about
what something "ought to do". Who is a "normal user"?

ChrisA



More information about the Python-list mailing list