Learning Python is not harder then studying for CCNA exam. There are almost unlimited number of books, blog posts and other materials out there. Python is just so popular.
The good news is we don’t need to know everything to start using it, and this is one of the many advantages the language has.
Automating a boring task in form of a script is the first simple use-case. We might extend the project, and get some structure in-place later. Perhaps we begin to use classes and decorators during the journey.
Structuring the project
In Python, the file structure of the project matters. At root directory of the project we have some well know files worth creating:
requirements.txt: capture dependencies
LICENSE: License of the project
Actual code is structured into one or more python files. As the appliaction gets more complicated, python provides option to package functions into modules. Modules are essentially folders in the project directory including python files. Usually a single file
__init__.py instucts the interpeter that a folder is a module. However this file is no longer mandatory from Python 3.3+.
To get more information regarding starting a project, check out these fine blog posts:
- https://jeffknupp.com/blog/2013/08/16/open-sourcing-a-python-project-the-right-way/ — demonstrating how to structure a project for publishing it as an open source package with emphasis on Git for version control, GitHub for project management.
- https://jeffknupp.com/blog/2014/02/04/starting-a-python-project-the-right-way/ — showing how to begin structuring a project from scratch, by adding placeholders for methods and attributes and completing them as the code progresses.
- https://realpython.com/documenting-python-code/ — Labeling certain sections of the code for issues, fixes or improvements using the tags such as BUG, FIXME, and TODO
Learning Python requires practices. Sites below offer interactive trainings and tutorials. They are mostly free, so check out them, and decide which one is better.
Python Do it your self
For reference, it is also good to use some books. I have included a few, but there are so many others..
- Podcast.__init__ (podcast)
Python related sites
I recommend to subscribe to medium, it has a lot of fine development related articles.
That's it for now, but in the next post I will try to collect Network Engineering related materials.