joelgrus / data-science-from-scratch

code for Data Science From Scratch book
MIT License
8.71k stars 4.52k forks source link

Error in Whitespace Formatting in Chapter 2 #11

Closed iphyer closed 9 years ago

iphyer commented 9 years ago

Sorry I encountered this in the book in Chapter 2:

One consequence of whitespace formatting is that it can be hard to copy and paste code into the Python shell. For example, if you tried to paste the code:

for i in [1, 2, 3, 4, 5]:

notice the blank line

            print   i

into the ordinary Python shell, you would get a: IndentationError: expected an indented block because the interpreter thinks the blank line signals the end of the for loop’s block.

But it actually works in my Python Shell.

1

So I am confused whether it is right?

joelgrus commented 9 years ago

It gives an error on my machine, maybe the Chinese build of Python works differently?

iphyer commented 9 years ago

Yeap, And I believe there maybe some other reasons。 See below: picture1