When newcomers think of arrays, they may have an idea that this is implemented in Python as the built-in list type. However, as in other languages, Python lists and arrays are actually quite different. Even experienced Python developers often reach for the list type first when they need a sequence type, and for most cases, … Read more
Separating tests and source is not hard to do in Python, if you start your source directory at the root of the package structure. This is not hard in principle, but it trips up developers coming from other languages. We review how one popular library does it (which is in line with the pytest docs), … Read more
Python is popular because it is simple to learn and use, with a syntax that makes it as easy to understand as plain English. This ease of use together with highly optimized libraries written in C has made it a favorite in the scientific community, especially for data science and machine learning. Python is not … Read more
A Python package is simply a directory, usually containing Python modules (source files with the .py extension). It frequently will include a special marker file, __init__.py. Packages can easily be created and used locally, and published packages can be installed using pip. Learning to install public packages and create packages locally is not difficult, though … Read more
Yes, it’s true that Python is slower at runtime than some other languages, but it’s fast enough for the tasks for which it is commonly used. Yes, it’s true that Python is slower at runtime than some other languages, but it’s fast enough for the tasks for which it is commonly used. For the most common tasks, the popular libraries use well-optimized C code — but you don’t need to know C to use them. We separate the facts from the myths.
Python functions have a relatively simple syntax that is very beginner-friendly. It also supports many advanced options, that we cover in this article.
Two of my favorite functions for interactively exploring Python objects are dir and type. Calling the dir function with no attributes returns information about what’s defined in the current module — either by default when you start the python interpreter, or because you’ve done imports, defined variables and functions and classes, etc. Calling dir and … Read more
The 100 Days are not consecutive. Do them at your own pace. That said, if it takes you 10 years to do the 100 days, you’re doing it wrong. A journey of 1000 miles begins with a single step. A journey of 100 days begins by forking the repo. If you’re unsure of something or … Read more