Trying to understand nested loops

avi.e.gross at gmail.com avi.e.gross at gmail.com
Fri Aug 5 19:41:59 EDT 2022


I wonder if someone is pulling our leg as they are sending from an invalid
email address of "GB <NOTsomeone at microsoft.invalid>" which is a bit sick.

I have trouble imagining ANYONE learning a language like python without
rapidly being told that python uses indentation instead of various ways to
detect when a body of text is considered a single composite item.

And code like their example is also nonsense:

print(var)
     print(var)
         print(var)

On my version of python, and likely most or all, it generates an error
message like: 

	SyntaxError: multiple statements found while compiling a single
statement

The way I see it, it is beyond irrelevant when learning a language what YOU
(the learner) think. The rules are the rules. If you do not like them and do
not have to use that language, go find another you might like.

If you want to stay with the language, you not only adjust but welcome new
ways of doing things. I have seen people stuck on code like this:

a, b, c = 5,4,3

others get nauseous at something like:

a, b, _ = some_func(args)

But the whole point is learning to appreciate what someone decided might
make the language more useful, easier to program in, avoid errors, be more
flexible, or maybe more efficient, or whatever design criteria apply. Only
once you understand more things like that, can you be in a position to
critique it as horrible.

So, speaking for myself, the poster is assumed, for now, to not be worth
responding to. I doubt they are a true beginner or at least that they have
spent any serious time learning.


-----Original Message-----
From: Python-list <python-list-bounces+avi.e.gross=gmail.com at python.org> On
Behalf Of GB
Sent: Friday, August 5, 2022 5:57 AM
To: python-list at python.org
Subject: Re: Trying to understand nested loops

On 05/08/2022 08:56, Frank Millman wrote:

> BTW, there is an indentation error in your original post - line 5 
> should line up with line 4.

As a Python beginner, I find that Python is annoyingly picky about indents.
And, the significance of indents is a bit of a minefield for beginners.

For example, in the above code, the indent of the final line very
significantly affects the results:

print(var)
     print(var)
         print(var)

These are all different.



--
https://mail.python.org/mailman/listinfo/python-list



More information about the Python-list mailing list