Indentation example?
ICT Ezy
ictezy at gmail.com
Mon Jun 13 23:43:36 EDT 2016
On Monday, June 13, 2016 at 3:09:15 AM UTC+5:30, Marc Dietz wrote:
> 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?
>
> Hi!
>
> 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. :)
>
> Cheers
> Marc.
Thank you very much your explaination here
More information about the Python-list
mailing list