One of Python’s biggest strengths is the enormous number of user-contributed packages available for free. Python packages can be offered anywhere but are most commonly published in the Python Package Index.
The Python Package Index, PyPI for short, contains more than 270K packages. Let’s explore some of the most-used packages and find out how to install them using a tool called pip.
Just to get a taste of what’s available, here are seven packages I personally like and use a lot.
In mathematics, there’s a concept called set-builder notation, also called set comprehension. Inspired by this principle, Python offers comprehensions, too. In fact, list comprehensions are one of the defining features of Python. They allow us to create concise, readable code that outperforms the uglier alternatives like for
loops or using map()
.
We’ll first look at the most well-known type: list comprehensions. Once we’ve got a good grasp of how they work, you’ll also learn about set comprehensions and dictionary comprehensions.
Originally published in Python Land’s Python Tutorial on list comprehensions.
A list comprehension is a language construct. It’s used to create a list based on an existing list. Sounds a little vague, I know, but after a few examples, that ‘ah-ha!’ …
Python has a long history, starting around 1991 with its first release in a newsgroup called alt.sources
. Since then, we all know how omnipresent the language has become. Last year, Python ranked second in Redmonk’s list of the most popular programming languages. And I can tell you… this year won’t be different. Here’s why Python will stay among the top languages in 2021.
Originally published on Python Land. Make sure to check out our Python tutorial.
Python has a very vibrant community, and it’s very well maintained. …
I’ve recently switched from Grav CMS to WordPress on one of my sites, Python Land. I jotted down some lessons learned and some advanced tips while setting up this WordPress site that I’d like to share with anyone interested.
I’m not new to WordPress, and I’m certainly not new to running websites. I’ve been doing it for 25 years. My first sites used tables to structure the pages, CSS wasn’t invented yet, and SEO didn’t exist either. Yeah… I guess I’m that old (and wise, hopefully).
Anyways... without further ado, here we go!
Picking the right theme is hard; don’t underestimate it. There are many good-looking themes, but it’s hard to judge a book by its cover. There are many crappy themes that may look nice on the surface but are horribly coded and inflexible. They are built to sell, not to keep working flawlessly in the long run. …
When you finish a new version of your Python application, how do you build and deploy it? Do you change the version number, upload the new files to production, and be done with it?
There are better ways! Continuous Integration/Continuous Delivery (CI/CD) is the pinnacle of good software engineering practices. It’s the point where all other good practices come together.
CI/CD bridges the gap between development and operations because it automates and enforces important steps in building and deploying software. It ensures quality and takes human errors out of the loop.
This article will take an existing application and create a CI/CD pipeline for it. You’ll see how you can set up a professional CI/CD pipeline in under 15 minutes! …
Some things you don’t learn from books and schools. These lessons come right from the work floor; I learned them the hard way!
I love this one because it makes the ones hearing it (your manager) think for themselves:
Do you know how to force keyword arguments, create a function decorator, create anonymous functions, or unpack an array or dictionary into a function's arguments? Here are four advanced tricks regarding Python functions.
For more cool Python tricks, visit the author's website: Python.land
Keyword arguments have a number of advantages:
That’s nice, but you probably already knew these things. What you might not know is that you can also force keyword arguments. The details are described in PEP 3202, but it comes down to using an asterisk before the arguments you want to force as keyword arguments. Or, before everything, forcing all arguments to be keyword…
The dictionary is one of Python’s most powerful data types. In other programming languages and computer science in general, dictionaries are also known as associative arrays. They allow you to associate keys to values.
Let’s look at how we can create and use a dictionary in the Python REPL:
>>> phone_nrs = { 'Jack': '070-02222748', 'Pete': '010-2488634' }
>>> an_empty_dict = { }
>>> phone_nrs['Jack']
'070-02222748'
The first dictionary associates keys (names like Jack and Pete) with values (their phone numbers). The second dictionary is an empty one.
Now that you’ve seen how to initialize a dictionary, let’s see how we can add and remove entries to an already existing…
This advice is useful for both beginning and seasoned software developers. There are some jokes intertwined here, too, so you might want to put down that coffee mug.
Hopefully, you know that Java and Javascript are two entirely different things, despite their names. If you didn’t, don’t sweat it; many beginners get confused by it.
So why are they named so similarly?
This is a quote from an interview with JavaScript creator Brendan Eich:
InfoWorld: As I understand it, JavaScript started out as Mocha, then became LiveScript and then became JavaScript when Netscape and Sun got together. …
Although I’ve been a big fan of Apple’s Macbook Air and Macbook Pro, I’ve recently made the switch to a Dell XPS laptop with Windows on it.
I initially planned on wiping the Dell hard drive to install Linux on it, but since the beast has a 2 TB SSD disk, I changed my mind and decided to create a dual boot setup and keep Windows.
Read on to see how I came to embrace Windows, after years of Linux and MacOS use!
Originally published on Python Land: Run Linux On Windows With WSL.
Now that I had Windows at my disposal again, I started experimenting with it. Although there have been cosmetic changes and improvements, there’s also a lot of stuff from the old days that seems pretty much unchanged. For example, there’s still that dreadful registry. Most shortcuts are unchanged, the look and feel are mostly the same, and the hardware support is still excellent. …