Why and how "there is only one way to do something"?

Mike Meyer mwm at mired.org
Fri Dec 16 00:13:34 CET 2005


bonono at gmail.com writes:
> The point is again, "obvious" is not so obvious sometimes.

You keep leaving out the context. We're writing *python*. What's
obvious when you're writing python won't be when you're writing
FORTRAN, or Scheme, or O'Caml, or Eiffel, or .... Generally (not
always, I'll admit), when you're writing python, there's one obvious
way to do something. If not, there's a good chance you're not writing
python, you're writing something else with python syntax.

> For most of the question I see asking here, they are from another
> language background and their obvious way is what they are asking for
> that they cannot find in python.

Back in the dark ages, when computers had entire rooms, if not
buildings, dedicated to them, I worked the support desk at a large
state university. Most people learned FORTRAN as a first language, and
then some of them went on to other languages. The standing observation
was that "You can write FORTRAN in any language." This is because
people would write FORTRAN constructs no matter what language they
were using. If the language had a goto, they'd write:

if not condition: goto after
# if body
after:

If the language didn't have a goto, they'd write:

if not condition:
else:
    # if body


And then they'd complain if the grader marked them down for doing
this kind of thing.

People coming from other languages trying to write the obvious way
from that language in python are doing the exact same thing as the
people who wrote the above fragments were doing: writing  <fill in the
blank> in python. It's not as obviously wrong because the languages
are more recent than FORTRAN, but it's just as wrong.

	<mike
-- 
Mike Meyer <mwm at mired.org>			http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.



More information about the Python-list mailing list