Reuven Lerner: Announcing: Free, weekly “Python for non-programmers” workshop

This is a tough time for the world. Wherever you live, you have likely been affected by covid-19, the coronavirus that has been making its way to every country, city, and town. Many countries, companies, and individuals are now restricted to their homes.  This can be frustrating in many ways.  Moreover, I’m not alone in believing that we’re about to see some very troubled times for the world economy. I’ve been trying to decide what I can do, as a Python instructor, to help people in these trying times.  And…

Read More

Ned Batchelder: Functional strategies in Python

I got into a debate about Python’s support for functional programming (FP) with a friend. One of the challenging parts was listening to him say, “Python is broken” a number of times. Python is not broken. It’s just not a great language for writing pure functional programs. Python seemed broken to my friend in exactly the same way that a hammer seems broken to someone trying to turn a screw with it. I understand his frustration. Once you have fully embraced the FP mindset, it is difficult to understand why…

Read More
Programming 

Python List extend() Method

How can you not one but multiple elements to a given list? Use the extend() method in Python. This tutorial shows you everything you need to know to help you master an essential method of the most fundamental container data type in the Python programming language. Definition and Usage The list.extend(iter) method adds all elements in the argument iterable iter to an existing list. Here’s a short example: >>> lst = [1, 2, 3] >>> lst.extend([4, 5, 6]) >>> lst [1, 2, 3, 4, 5, 6] In the first line…

Read More

Real Python: Using the Python defaultdict Type for Handling Missing Keys

A common problem that you can face when working with Python dictionaries is to try to access or modify keys that don’t exist in the dictionary. This will raise a KeyError and break up your code execution. To handle these kinds of situations, the standard library provides the Python defaultdict type, a dictionary-like class that’s available for you in collections. The Python defaultdict type behaves almost exactly like a regular Python dictionary, but if you try to access or modify a missing key, then defaultdict will automatically create the key…

Read More
Programming 

PyCoder’s Weekly: Issue #411 (March 10, 2020)

#411 – MARCH 10, 2020 View in Browser » Post-Mortem Python Plotting Who loves debugging things that only fail occasionally? Just me? Maybe you need to check out Andy Jones’ extract() function that “magically” extracts a caller’s environment into an IPython interpreter session. Mix in a little post-mortem debugging with Jupyter’s %debug magic command, and you’ll be painlessly debugging finicky code in no time. ANDY JONES How to Use Jupyter Notebooks in 2020 In this first of a three-part blog post, LJ Miranda surveys the data science landscape and discusses…

Read More

Anarcat: Font changes

I have worked a bit on the fonts I use recently. From the main font I use every day in my text editor and terminals to this very website, I did a major and (hopefully) thoughtful overhaul of my typography, in the hope of making things easier to use and, to be honest, just prettier. Monospace font: Fira mono This all started when I found out about the Jetbrains Mono font. I found the idea of ligatures fascinating: the result is truly beautiful. So I do what I often do…

Read More

Karim Elghamrawy: Private Methods in Python

Let me preface this article by emphasizing that understanding object-oriented programming (OOP) is crucial if you want to learn Python. One aspect of OOP is to learn how to define and use private methods. In this article, I will teach you how to create private methods, when to use them, and why they are necessary. […] The post Private Methods in Python appeared first on Afternerd.

Read More

Python 101: Learning About Lists

Lists are a fundamental data type in the Python programming language. A list is a mutable sequence that is typically a collection of homogeneous items. Mutable means that you can change a list after its creation. You will frequently see lists that contain other lists. These are known as nested lists. You will also see lists that contain all manner of other data types, such as dictionaries, tuples or objects. Let’s find out how you can create a list! Creating Lists There are several ways to create a list. You…

Read More

Real Python: Defining Main Functions in Python

Many programming languages have a special function that is automatically executed when an operating system starts to run a program. This function is usually called main() and must have a specific return type and arguments according to the language standard. On the other hand, the Python interpreter executes scripts starting at the top of the file, and there is no specific function that Python automatically executes. Nevertheless, having a defined starting point for the execution of a program is useful for understanding how a program works. Python programmers have come…

Read More
Programming 

13 Best Python Email Newsletters You Don’t Want to Miss (4 Bonus Podcasts)

Python is one of the most popular coding languages out there. Although it may not take long for you to learn the basics, it takes a lot of time and effort to become an expert. The best way to get there? Practice, practice, practice! In this article, we’ve put together 13 of the best Python newsletters out there, useful Python news and information you’ll receive to your inbox every single week or more often. We think they’re a great way to keep updated and stay serious with your continuous learning.…

Read More