Closed cdeil closed 7 years ago
Thanks for catching the typo – I'll merge this. I do like your suggested modification, so I'll make that change separately. Thanks!
Small detail on your change: this operation does not create a new value 15, but points it to an already existing 15
singleton. I'll try to figure out how to say that correctly without having to digress into the details of how Python optimizes handling of integer objects in memory!
Yes, right, I forgot: CPython pre-creates small ints. Probably not something to explain to people at that point in their Python career.
That's why I didn't attempt to write a better version ... :-)
I just pushed the change here: https://github.com/jakevdp/WhirlwindTourOfPython/commit/0269219cb4035463e1d66236013e25ef1d098d14
The ambiguity in the word "new" there (globally new or new in relation to x?) covers all the bases :smile:
👍 to 0269219cb4035463e1d66236013e25ef1d098d14 Short and correct now.
Just FYI, in case you hadn't seen it: one other intro I looked at yesterday was http://nbviewer.jupyter.org/github/oreillymedia/python_epiphanies/blob/master/Python-Epiphanies-All.ipynb#2-Names and there it's explained in more detail what happens. I guess going in depth in your whirlwind tour isn't appropriate, but specifically at this one point about how Python works, that other O'Reilly course / free notebook might be worth pointing out.
That's a nice discussion! I think that's based on Stuart Williams' PyCon tutorials by the same name, so I'm not surprised it's very good :smile: It's a bit more detail than I'd want to go into here though.
@jakevdp - First of all - thank you for writing and sharing these notebooks! We'll be teaching a Python bootcamp to astronomers in 2 weeks and plan to use your materials.
This PR fixes a typo in the 03-Semantics-Variables.ipynb notebook at the very end of this section: http://nbviewer.jupyter.org/github/jakevdp/WhirlwindTourOfPython/blob/master/03-Semantics-Variables.ipynb#Python-Variables-Are-Pointers
The current sentence is:
I wonder if this could be made clearer by adding in "new int object with value 15", i.e. something like
I didn't make the change here, because I wasn't sure it's better, so I just fixed the typo.