By the end of this project, you will gain knowledge and skills in the following areas:
- Understanding type annotations in Python 3.
- Using type annotations to specify function signatures and variable types.
- Exploring the concept of duck typing in Python.
- Validating your code for type correctness using Mypy.
- Editors: You are allowed to use vi, vim, or emacs for coding.
- Python Version: All code will be interpreted/compiled using Python 3 (version 3.7).
- File Endings: Ensure that all your files end with a newline character.
- Shebang Line: The first line of all your Python files should be exactly
#!/usr/bin/env python3
. - README.md: A mandatory README.md file must be present at the root of your project folder.
- Code Style: Your code should adhere to the pycodestyle style (version 2.5).
- Executable Files: All your Python files must be executable.
- File Length: The length of your files will be tested using
wc
. - Documentation:
- All your modules should have documentation. You can check this using
python3 -c 'print(__import__("my_module").__doc__)'
. - All your classes should have documentation. You can check this using
python3 -c 'print(__import__("my_module").MyClass.__doc__)'
. - All your functions, both inside and outside a class, should have documentation. You can check this using
python3 -c 'print(__import__("my_module").my_function.__doc__)'
andpython3 -c 'print(__import__("my_module").MyClass.my_function.__doc__)'
.
- All your modules should have documentation. You can check this using
- A documentation is not just a single word; it should be a complete sentence that explains the purpose of the module, class, or method. The length of your documentation will be verified.
This project is designed to help you improve your Python programming skills with a focus on variable annotations and type hinting. You will learn how to specify data types for variables, function parameters, and return values using type annotations. Additionally, you will explore the concept of duck typing and how to use the Mypy tool to validate your code for type correctness.
To get started with this project, follow these steps:
-
Clone the repository to your local machine.
-
Ensure you have the required Python version (3.7) installed.
-
Use your preferred editor (vi, vim, emacs) to work on the project files.
-
Follow the project requirements and guidelines outlined above to complete the tasks.
-
Use Mypy to validate your code for type correctness.
Happy coding!