Made with ♥ by Polyglot.
Why buy this guide? Well, if you were already thinking about learning how to code at all or wanted to specifically learn python, then, this is the guide for you because ...
Guide to programming Python by referencing other programming langauges. A polyglot Software Engineer has a broad set of skills, one of those skills is being able to understand, build with, and debug within many diverse programming languages.
Learn Python The Polyglot Way teaches you by allowing you to make the right mistakes on your own, not the ones we can help you avoid. By helping you avoid common issues, you learn more because the same lessons can be applied for any programming language you choose. You could almost take this guide, swap out Python and any pythonisms and it could be used as the base for a book for another programming language beause learning most programming lanuages is essentially the same.
Given you are not new to software programming languages, you've probably noticed that understanding a directory structure makes working with the code a lot smoother. There are no perfect solutions here, only well-reasoned community recommendations; however, that will do since the community usually speaks loudest through experience and through toughing it out through difficult situations where lessons are learned and those lessons are packaged up into standards or best practices or community recommendations.
- call out paths and / vs c:\ on windows and keeping things cross platform
- understand how the language handles finding packages and modules
what system file path was the module imported from?
mod.__file__
>>> sys.path.append(r'/Users/...')
a file containing python code and named with extension ending in
.py.
a directory of python modules & includes a
__init__.pyfile.
The package directory archived as
*.tar.gzor.zip.
Development ENV for teams can test with & without. Library, no checkin
Every modern programming environment has a way to set a function or a module as the main or default piece of code to run upon initial execution. Python provides facilities that make it easy to figure out if a module is being called as the main entrypoint or if it's simply being imported.
We would test this by modifying
sys.argv[0]before calling the
if __name__ == `__main__`
import sys
print('Hello {0}'.format(sys.argv[0]))
- Python Record Linkage Toolkit (Similar to Java-based Duke)
numpy
pandas
PySpark
cx_Oracle
snowflake.connector
pyodbc
fastjsonschema
Poetry installs your packages into the virtual environment's site packages. This allows pytest to find your package without the need to manipulate sys.path directly in the test's __ini__.py.
This list is not exhaustive. These are all of the commands I've actually had to use so far.
> poetry new example
> poetry install
> poetry run pytest
> poetry build
> poetry publish
> poetry add requests
> poetry add pylint flask
> poetry install
> poetry env use python3.7