tailieunhanh - Ebook Texts in computational science and engineering (3rd edition): Part 2

(BQ) Part 2 book "Texts in computational science and engineering" has contents: Advanced python, fortran programming with NumPy arrays; C and C++ programming with NumPy arrays; more advanced GUI programming, tools and examples. | Chapter 8 Advanced Python This chapter extends the overview of Python functionality in Chapter 3. Miscellaneous topics like modules for parsing command-line arguments and how to generate Python code at run time are discussed in Chapter . The comprehensive Chapter is devoted to regular expressions for interpreting and editing text. Lots of tools for storing and retrieving data in files are covered in Chapter , while Chapter explores compact file storage of numerical data represented as NumPy arrays. Chapter outlines methods for working with a local and a remote host when doing tasks like simulation and visualization. Chapter treats numerous topics related to class programming. Chapter discusses scope of variables. Error handling via exceptions is described in Chapter . Extending for loops to iterate over user-defined data structures via Python iterators is the subject of Chapter . Finally, in Chapter we present methods for investigating the efficiency of a script and provide some advice on optimizing Python codes. Readers who are interested in more advanced Python material are highly recommended to read the “Python Cookbook” [23]. Miscellaneous Topics This subchapter describes various useful modules and constructs of wide applications in Python scripts. Parsing command-line arguments is a frequently encountered task in scripting, and the process can be automated using two modules presented in Chapter . Although most operations in Python scripts have a uniform syntax independent of the underlying operating system, some operations demand platform-specific hooks. Chapter explains how this can be done. A nice feature of Python and other dynamically typed languages is the possibility to build code at run time based on user input. Chapter gives a quick intro to this topic. Parsing Command-Line Arguments In Chapter we demonstrate simple manual parsing of command-line arguments. However, the recommended .