joelgrus / data-science-from-scratch

code for Data Science From Scratch book
MIT License
8.63k stars 4.5k forks source link

One suggestion for displaying Code examples #59

Open felix4webscience opened 5 years ago

felix4webscience commented 5 years ago

Hey @joelgrus ,

I would like to thank you for all the work you are doing here. I would still like to recommend one or two improvements for your new book or even than for your code examples... depending on which python version someone is using. You should show "white spaces" and "indentions".

Thus in Python2.7 you could write (2,10) but in Python 3.5 you have to add one 'white space' behind the comma -> (2, 10). Beside that, it is not always clear if an indention is expected or not from your site. It might depending on the IDE, spyder for instance is running mad about a lot of indention errors but at the same time my console is complaining about syntax errors....

You can reproduce this issue by copy + pasting your own code for example to:

python.org , where you can find a live environment for python 3.7 ok, this will be pretty obvious show you a lot of errors... but than you know what I mean...

In the O'reilly book, it is also not always clear, if the code is continuing on the next page, in the same "column" or how many spaces are expected, because the 4 spaces rule does not always count . Thus it might be useful to just work in the book and also here, with kind of "syntax" and visuals, like:

grafik.

grafik

Just my few Cents,

Greetings.