alzi at capella.uberspace.de
Sun Jun 12 17:39:02 EDT 2016
On Sun, 12 Jun 2016 08:10:27 -0700 ICT Ezy wrote:
> Pl explain with an example the following phase "Indentation cannot be
> split over multiple physical lines using backslashes; the whitespace up
> to the first backslash determines the indentation" (in 2.1.8.
> Indentation of Tutorial.)
> I want to teach my student that point using some examples.
> Pl help me any body?
This is my very first post inside the usenet. I hope I did understand
this right, so here is my answer. :)
I assume, that you do understand the concept of indentation inside Python
code. You can concatenate lines with a backslash. These lines work as if
they were only one line. For example:
>>> print ("This is a very long"\
... " line, that got "\
... "diveded into three lines.")
This is a very long line, that was diveded into three.
Because the lines get concatenated, one might think, that you could
divide for example 16 spaces of indentation into one line of 8 spaces
with a backslash and one line with 8 spaces and the actual code.
Your posted text tells you though, that you can't do this. Instead the
indentation would be considered to be only 8 spaces wide.
I hope this helped a little. :)
More information about the Python-list