Web-Books
in the Austria-Forum
Austria-Forum
Web-Books
Informatik
Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Volume Second Edition
Page - 36 -
  • User
  • Version
    • full version
    • text only version
  • Language
    • Deutsch - German
    • English

Page - 36 - in Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Volume Second Edition

Image of the Page - 36 -

Image of the Page - 36 - in Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Volume Second Edition

Text of the Page - 36 -

36 1 TheFirstFewSteps run for hours, days, and even weeks. Fast code is tremendously important in those cases. The problem with a strong focus on fast code, unfortunately, is that sometimes clear and easily understandable constructions are replaced by fast (and possibly clever), but less readable code. For beginners, however, it is definitely most important to learnwriting readableandcorrect code. Wewillmakesomecommentsonconstructionsthatarefastorslow,but themain focusof thisbookis to teachhowtowritecorrectprograms,not the fastestpossible programs. 1.8.4 DeletingDataNoLongerinUse Python has automatic garbage collection, meaning that there is no need to delete variables (or objects) that are no longer in use. Python takes care of this by itself. This isopposedto,e.g.,Matlab,whereexplicitdeletingsometimesmayberequired. 1.8.5 CodeLinesThatAreTooLong If a code line in a program gets too long, it may be continued on the next line by inserting a back-slash at the end of the line before proceeding on the next line. However,noblanksmustoccurafter theback-slash!Alittledemonstrationcouldbe the following, my_sum = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 +\ 14 + 15 + 16 + 17 + 18 + 19 + 20 So, theback-slashworksasa line continuationcharacterhere. 1.8.6 WheretoFindMoreInformation? We have already recommended Langtangen’s book, A Primer on Scientific Pro- grammingwithPython (Springer,2016),as themainreferencefor thepresentbook. In addition, there is, of course, the official Python documentation website (http://docs.python.org/), which provides a Python tutorial, the Python Library Reference, a Language Reference, and more. Several other great books are also available, checkout, e.g.,http://wiki.python.org/moin/PythonBooks. Asyoudoknow,searchengineslikeGoogleareexcellentforfindinginformation quickly, so also with Python related questions! Finally, you will also find that the questions and answers at http://stackoverflow.com often cover exactly what you seek. Ifnot,youmayask yourownquestions there.
back to the  book Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Volume Second Edition"
Programming for Computations – Python A Gentle Introduction to Numerical Simulations with Python 3.6, Volume Second Edition
Title
Programming for Computations – Python
Subtitle
A Gentle Introduction to Numerical Simulations with Python 3.6
Volume
Second Edition
Authors
Svein Linge
Hans Petter Langtangen
Publisher
Springer Open
Date
2020
Language
English
License
CC BY 4.0
ISBN
978-3-319-32428-9
Size
17.8 x 25.4 cm
Pages
356
Keywords
Programmiersprache, Informatik, programming language, functional, imperative, object-oriented, reflective
Category
Informatik
Web-Books
Library
Privacy
Imprint
Austria-Forum
Austria-Forum
Web-Books
Programming for Computations – Python