{"title":"Idiomatic Python","authors":"Wolfgang Goethe","doi":"10.1017/9781108772310.002","DOIUrl":"https://doi.org/10.1017/9781108772310.002","url":null,"abstract":"This chapter is not intended as an introduction to programming in general or to programming with Python. A tutorial on the Python programming language can be found in the online supplement to this book; if you’re still learning what variables, loops, and functions are, we recommend you go to our tutorial (see Appendix A) before proceeding with the rest of this chapter. You might also want to have a look at the (official) Python Tutorial at www.python.org. Another introduction to Python, with nice material on visualization, is Ref. [41]. Programming, like most other activities, is something you learn by doing. Thus, you should always try out programming-related material as you read it: there is no royal road to programming. Even if you have solid programming skills but no familiarity with Python, we recommend you work your way through one of the above resources, to familiarize yourself with the basic syntax. In what follows, we will take it for granted that you have worked through our tutorial and have modified the different examples to carry out further tasks. This includes solving many of the programming problems we pose there. What this chapter does provide is a quick summary of Python features, with an emphasis on those which the reader is more likely not to have encountered in the past. In other words, even if you are already familiar with the Python programming language, you will most likely still benefit from reading this short chapter. Observe that the title at the top of this page is Idiomatic Python: this refers to coding in a Pythonic manner. The motive is not to proselytize but, rather, to let the reader work with the language (i.e., not against it); we aim to show how to write Python code that feels “natural”. If this book was using, say, Go or Julia instead of Python, we would still be making the same point: one should try to do the best job possible with the tools at one’s disposal. As noted in the Preface, the use of idioms allows us to write shorter codes in the rest of the book, thereby emphasizing the numerical method over programming details; this is not merely an aesthetic concern but a question of cognitive consonance. At a more mundane level, this chapter contains all the Python-related reference material we will need in this volume: reserved words, library functions, tables, and figures. Keeping the present chapter short is intended to help you when you’re working through the following chapters and need to quickly look something up.","PeriodicalId":160381,"journal":{"name":"Numerical Methods in Physics with Python","volume":"6 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2020-08-27","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"125406345","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
{"title":"Index","authors":"","doi":"10.1017/9781108772310.014","DOIUrl":"https://doi.org/10.1017/9781108772310.014","url":null,"abstract":"","PeriodicalId":160381,"journal":{"name":"Numerical Methods in Physics with Python","volume":"12 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2020-08-27","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"114596430","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
{"title":"Math Background","authors":"","doi":"10.1017/9781108772310.012","DOIUrl":"https://doi.org/10.1017/9781108772310.012","url":null,"abstract":"","PeriodicalId":160381,"journal":{"name":"Numerical Methods in Physics with Python","volume":"22 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2020-08-27","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"129994536","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
{"title":"Installation and Setup","authors":"Scott A. Prentice, dita-fmx, Scott A. Prentice","doi":"10.1017/9781108772310.010","DOIUrl":"https://doi.org/10.1017/9781108772310.010","url":null,"abstract":"","PeriodicalId":160381,"journal":{"name":"Numerical Methods in Physics with Python","volume":"44 1 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2020-08-27","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"117207934","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}
{"title":"Matrices","authors":"P. Joyce","doi":"10.1201/9781315219707-33","DOIUrl":"https://doi.org/10.1201/9781315219707-33","url":null,"abstract":"","PeriodicalId":160381,"journal":{"name":"Numerical Methods in Physics with Python","volume":"71 1","pages":"0"},"PeriodicalIF":0.0,"publicationDate":"2018-06-07","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":null,"resultStr":null,"platform":"Semanticscholar","paperid":"127161592","PeriodicalName":null,"FirstCategoryId":null,"ListUrlMain":null,"RegionNum":0,"RegionCategory":"","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":"","EPubDate":null,"PubModel":null,"JCR":null,"JCRName":null,"Score":null,"Total":0}