Book contents
- Frontmatter
- Contents
- Preface
- 1 Introduction
- 2 Getting started with IPython
- 3 A short Python tutorial
- 4 Numpy
- 5 Two-dimensional graphics
- 6 Three-dimensional graphics
- 7 Ordinary differential equations
- 8 Partial differential equations: a pseudospectral approach
- 9 Case study: multigrid
- Appendix A Installing a Python environment
- Appendix B Fortran77 subroutines for pseudospectral methods
- References
- Index
3 - A short Python tutorial
Published online by Cambridge University Press: 05 August 2014
- Frontmatter
- Contents
- Preface
- 1 Introduction
- 2 Getting started with IPython
- 3 A short Python tutorial
- 4 Numpy
- 5 Two-dimensional graphics
- 6 Three-dimensional graphics
- 7 Ordinary differential equations
- 8 Partial differential equations: a pseudospectral approach
- 9 Case study: multigrid
- Appendix A Installing a Python environment
- Appendix B Fortran77 subroutines for pseudospectral methods
- References
- Index
Summary
Although Python is a small language it is a very rich one. It is very tempting, when writing a textbook, to spell out all of the ramifications, concept by concept. The obvious example is the introductory tutorial from the originator of Python, Guido van Rossum. This is available in electronic form as the tutorial in your Python documentation or on-line or as hard copy, van Rossum and Drake Jr. (2011). It is relatively terse at 150 printed pages, and does not mention numpy. My favourite textbook, Lutz (2009) runs to over 1200 pages, a marathon learning curve, and only mentions numpy in passing. It is excellent at explaining the features in detail, but is too expansive for a first course in Python. A similar criticism can be applied to two books with a more scientific orientation, Langtangen (2008) and Langtangen (2009), both around 700 pages with a significant overlap between them. I recommend these various books among many others for reference, but not for learning the language.
Very few people would learn a foreign language by first mastering a grammar textbook and then memorizing a dictionary. Most start with a few rudiments of grammar and a tiny vocabulary. Then by practice they gradually extend their range of constructs and working vocabulary. This allows them to comprehend and speak the language very quickly, and it is the approach to learning Python that is being adopted here.
- Type
- Chapter
- Information
- Python for Scientists , pp. 20 - 51Publisher: Cambridge University PressPrint publication year: 2014