Type Hints were added to python 3.5 as a way of adding support for linters and 3rd party tools to check code for possible errors. These have no effect of the running of the code and are not mandatory, however they are good software engineering practice and we encourage their use throughout your code.
Aims We will investigate some modern python features and concepts by developing some small programs.
Type Hinting Type hints were added to python 3.5 as a way of adding support for linters and 3rd party tools to check code for possible errors. These have no effect of the running of the code and are not mandatory, however they are good software engineering practice and we encourage their use throughout your code.
Overview In this session we will look at how to read and write files in Python. We will cover the following topics:
Opening and closing files Reading and writing text files context managers We will also continue to develop our csv writer program from the previous session.
Introduction In Lab3 we introduced the PyEnv tool to allow us to install various versions of python either locally or globally, and we installed the Anaconda distribution of python which includes many of the libraries we will be using in the course.
Aims We will investigate some modern python features and concepts by developing some small programs.
Type Hinting Type hints were added to python 3.5 as a way of adding support for linters and 3rd party tools to check code for possible errors. These have no effect of the running of the code and are not mandatory, however they are good software engineering practice and we encourage their use throughout your code.
Why do I need it? Life is too short to tidy up code by hand. Black is an opinionated python formatter. By using it, you agree to cede control over minutiae of hand-formatting.
Why do I need it? numpy is “The fundamental package for scientific computing with Python”. In particular it gives us fast and efficient array types which can be used with C/C++ types as well.
Why do I need it? These two co-related modules will make your command line tools better. “Rich is a Python library for rich text and beautiful formatting in the terminal”, “Textual is a TUI (Text User Interface) framework for Python inspired by modern web development.” which uses Rich for printing. See https://github.com/Textualize/rich and https://github.com/Textualize/textual