Programming 

What is __init__ in Python?

Reading over other people’s Python code, beginners often stumble over the __init__(self) method. What’s its purpose? This article answers this question once and for all. So what’s __init__(self) in Python? The __init__ method is the constructor of a class. The constructor method initializes the attributes of a classes’ instance. Say, you define a class Dog with instance attribute color. When creating a specific Dog instance, the constructor method is where you set its color. While this answers the question, if you’ve got any ambition in becoming a professional Python coder,…

Read More
Programming 

Mike Driscoll: PyDev of the Week: Vuyisile Ndlovu

This week we welcome Vuyisile Ndlovu (@terrameijar) as our PyDev of the Week! Vuyisile is a contributor to Real Python and a Python blogger on his own website. He is also active in the Python community in Africa. You can find out more about Vuyisile on his website or by checking out his Github profile. Let’s take some time to get to know him better! Can you tell us a little about yourself (hobbies, education, etc): I’m a developer from Bulawayo, Zimbabwe. I have always been fascinated by computers so…

Read More

Weekly Python StackOverflow Report: (ccii) stackoverflow python report

These are the ten most rated questions at Stack Overflow last week.Between brackets: [question score / answers count]Build date: 2019-11-09 16:17:22 GMT Why did dict.get(key) work but not dict[key]? – [15/3] How can I use functional programming to make a generic method in python? – [8/1] How is `var[:] = []` different from `var = []`? – [7/3] dtypes muck things up when shifting on axis one (columns) – [7/2] How to specify index of specific elements in every sublist of nested list? – [6/4] How to remove substrings from…

Read More

Rene Dudfield: Draft 2 of, ^Let's write a unit test!^

So, I started writing this for people who want to ‘contribute’ to Community projects, and also Free Libre or Open source projects. Maybe you’d like to get involved, but are unsure of where to begin? Follow along with this tutorial, and peek at the end in the “what is a git for?” section for explanations of what some of the words mean. Draft 1, 2018/07/18 – initial draft.Draft 2, 2019/11/04 – two full unit test examples, assertions, making a pull request, use python 3 unittest substring search, “good first issue”…

Read More

When to Use a List Comprehension in Python

Python is famous for allowing you to write code that’s elegant, easy to write, and almost as easy to read as plain English. One of the language’s most distinctive features is the list comprehension, which you can use to create powerful functionality within a single line of code. However, many developers struggle to fully leverage the more advanced features of a list comprehension in Python. Some programmers even use them too much, which can lead to code that’s less efficient and harder to read. By the end of this tutorial,…

Read More

Reuven Lerner: Podcasts, podcasts, and even more podcasts

I’ve recently appeared on a whole bunch of podcasts about Python, freelancing, and even (believe it or not) learning Chinese! If you’re interested in any or all of these subjects, then you might want to catch my interviews: Talk Python to Me: I spoke with Michael Kennedy (and Casey Kinsen) about freelancing in Python — and things to consider when you’re thinking of freelancing. Programming Leadership: I spoke with Marcus Blankenship about why companies offer training to their employees, how they should look for training, and how best to take…

Read More

Erik Marsja: How to Handle Coroutines with asyncio in Python

The post How to Handle Coroutines with asyncio in Python appeared first on Erik Marsja. When a program becomes very long and complex, it is convenient to divide it into subroutines, each of which implements a specific task. However, subroutines cannot be executed independently, but only at the request of the main program, which is responsible for coordinating the use of subroutines. In this post, we introduce a generalization of the concept of subroutines, known as coroutines: just like subroutines, coroutines compute a single computational step, but unlike subroutines, there…

Read More
Programming 

Python’s Random Module – Everything You Need to Know to Get Started

Life is unpredictable. Sometimes good things happen out of the blue like you find $100 on the floor. And sometimes bad things happen, like your flight being canceled because of bad weather. Most programming languages have a module to deal with randomness. Python is no exception coming with the module named random and in this article, we’ll be looking at the most essential functions you need to use it. The Absolute Basics Before we use any function from the random module, we must import it. import random Because we’re dealing…

Read More

PyDev of the Week: Joannah Nanjekye

This week we welcome Joannah Nanjekye (@Captain_Joannah) as our PyDev of the Week! Joannah is a core developer of the Python programming language. She is also the author of Python 2 and 3 Compatibility. You can find out more about Joannah on here website. Let’s take a few moments to get to know her better! Can you tell us a little about yourself (hobbies, education, etc): I am Joannah Nanjekye, I live in Canada, Fredericton but I am originally from Uganda in East Africa. I am a CS grad and…

Read More
Programming 

Samuel Sutch: Python for Kids: A Playful Introduction to Programming

Price: $19.79(as of Oct 28,2019 15:15:29 UTC – Details) From the Author: Top 5 Tips & Tricks for Beginning Programmers 1. Never try to understand a long piece of code (or a long program) in one go. Focus on a few statements at a time. If possible, try to take a smaller chunk of the code and run it yourself to see what it does. Experimenting is always good, even if it doesn’t work and you get weird error messages, you’ve learned something!

Read More