I am new to python. I have a few questions coming from an armature!

Marko Rauhamaa marko at pacujo.net
Wed Aug 17 10:57:40 EDT 2016


"D'Arcy J.M. Cain" <darcy at Vex.Net>:

> On Wed, 17 Aug 2016 16:39:30 +1000
> Steven D'Aprano <steve+comp.lang.python at pearwood.info> wrote:
>>         cond ? trueval : falseval 
>> 
>> Because the C syntax is horrifically ugly, whereas the Python syntax
>> is very close to real English syntax.
>
> Or, put another way, Python prefers English over line noise.

It can also be confusing. I recently introduced programming to someone
using Python. Because of its similarity with English, they thought
Python understood stuff like:

    if x or y == 0:
        ...

for:

    if x == 0 or y == 0:
        ...


or:

    if (x, y) is self.on_point():
        ...

for:

    if self.on_point(x, y):
        ...


Somewhat analogously, I remember how confusing it was to learn formal
logic in college. I was having a hard time getting the point of
definitions like:

   (x ∧ y) is true iff x is true and y is true

That's because I had learned in highschool that "x ∧ y" was just an
abbreviation of "x and y".


Marko



More information about the Python-list mailing list