PyDev of the Week: Amir Rachum

This week we welcome Amir Rachum as our PyDev of the Week. Amir is the author / maintainer of pydocstyle and yieldfrom. Amir also write a fun little blog about Python. Let’s take a few moments to get to know Amir better!

Can you tell us a little about yourself (hobbies, education, etc):

I’m an Israeli software developer from the Tel Aviv area. I have a B.Sc in Software Engineering. I spent three out of the four years of my degree working in a student position to get some real-world experience, which I believe made a huge difference to this day (a positive one for my skills, less so for my grades).

On my spare time, I enjoy playing board games with friends – I have over 200 board games in my collection, so far. Continue reading PyDev of the Week: Amir Rachum

wxPython: Working with Status Bars

Most applications come with the Status Bar. The status bar is the widget along the bottom of most applications that you use every day. They give you information about what line you’re editing in a text editor or when you last saved. In wxPython, you can add a status bar to your frame by using the wx.StatusBar class. In this article, we will learn all about how to use status bars in wxPython.

No Status Bars

It’s always good to start at the beginning. So we will begin our journey by looking at some sample code that shows what a frame looks like without a status bar:

import wx
class MainFrame(wx.Frame):
    def __init__(self):
        wx.Frame.__init__(self, None, title='No Statusbars')
        panel = wx.Panel(self)
if __name__ == '__main__':
    app = wx.App(False)
    frame = MainFrame()

When you run this code, you should see something like the following:

Continue reading wxPython: Working with Status Bars

PyDev of the Week: Andrew Godwin

This week we welcome Andrew Godwin (@andrewgodwin) as our PyDev of the Week! Andrew is a core developer of the popular Python web framework, Django. Andrew maintains a blog of his adventures but if you’re more interested in his code, then you’ll want to check out his Github profile. You can also check out some of his projects here. Let’s take a few moments to get to know Andrew better!

Can you tell us a little about yourself (hobbies, education, etc):

Well, I grew up in suburban South London, and initially started programming on my mum’s Palm IIIx in BASIC when I was bored during holidays and longer trips, along with trying out my hand at HTML at the local library. Eventually this turned into me doing Computer Science at Oxford (I almost went for physics, but changed my mind as I wanted an easier life), where I learnt a decent amount of theory that I almost never use in practice, and instead draw on my time writing open source software since I was about 15 and what it’s taught me about maintainability, software architecture and the importance of helping other people.

Hobby-wise, I probably have too many; the one I spend most time on apart from programming (both open-source and noodling away on the occasional game) is probably flying (as in, piloting light aircraft) and then traveling (as in, flying on other people’s aircraft). On the side, I also do electronics, 3D printing/making things, riding my motorbike, archery, photography, cinematography, baking, and when the season is right, snowsports. I’m also on a rough quest to visit every state and territory of the US as well as all 59 of the National Parks, so I have my work cut out.

Continue reading PyDev of the Week: Andrew Godwin

PyDev of the Week: Terry Peppers

This week we welcome Terry Peppers (@club_is_open) as our PyDev of the Week. Terry has been a very active member of the Testing in Python group and is quite active as an organizer for PyCon USA. You can get a feel for what projects interest him over on Github. Let’s take a few moments to get to know Terry better!

Can you tell us a little about yourself (hobbies, education, etc):

I am the Vice President of Engineering for Leapfrog Online based in Evanston, IL.

I went to Loyola University, Chicago and have a degree in Psychology, English and Sociology.

I like to run, read, cook and spend time with my family. My current guilty pleasure is the first person shooter Destiny by Bungie. I play on the PS4 and have been playing for a really long time. My best Destiny/Python crossover was playing with Python core committer, Brett Cannon!

Why did you start using Python?

I’m not a classically trained computer scientist. From the age of 11, though, I had been a bit of a dabbler in a bunch of different programming languages; I have had a lot of phases of learning/struggling Bash, Perl, PHP and even Ruby. A lot of the time I felt like those languages were programming me and I wasn’t programming with them, which was frustrating.

One of my first real software engineering tasks was doing browser automation for testing, which is really fancy way of doing screen scraping. I had been using a library in Ruby and was really struggling with its performance. Our Senior Software Engineer on staff at the time, Jason Pellerin, looked at my code and said, “I bet it would be easier if you did this in Python.” And while the learning curve was similar to other languages I knew, I finally felt like I was fully leveraging a language and its capabilities. Python really just fit my brain.

Continue reading PyDev of the Week: Terry Peppers

PyDev of the Week: Harrison Kinsley

This week’s PyDev of the Week is Harrison Kinsley. Harrison is the creator of a popular Python Youtube tutorial channel. He also maintains a website that is kind of a text version of his video tutorials here: Let’s take a few moments to get to know Harrison better!

Can you tell us a little about yourself (hobbies, education, etc):

As cliche as it will sound, my biggest hobby is programming without a doubt. That said, I also enjoy running, scuba diving, and performance driving. There are various tracks (think: F1 racing) that you can take your street car to, some are actual F1 tracks. I tend to track my car (Honda S2000) once or twice a month over the weekend.

As for education, I have no formal CS or related education. I double majored in Philosophy and Criminal Justice.

I am married, live in Texas, and have a couple large dogs.

Why did you start using Python?

It’s funny, I actually disliked programming for a long time. I had wanted to learn to program since I was about 12 years old, I kept trying, but I just hated it. Too tedious, too annoying, too confusing.

Fast forward to college, by this point I had a few online businesses, but was always just paying developers to work for me. This time, my idea was to track sentiment for stocks for investing/trading. I didn’t know anyone who could do that for me, so I revisited programming yet again with this goal in mind. I tried quite a few languages again, was left pretty bummed out overall, but then a friend of mine mentioned that a programming language called Python had a natural language processing library called Natural Language Toolkit (NLTK). I quickly found their book on, and it was perfect for me, since it was exactly what I wanted. I went through the book, and that’s how I learned python and begun my journey. That project still exists today as (sentdex = sentiment+index), and that’s also how my “Sentdex” e-name was formed.
Continue reading PyDev of the Week: Harrison Kinsley

Python 2017 – Second Day

The second day of the PyCon 2017 conference was kicked off by breakfast with people from NASA and Pixar, among others, followed by several lightning talks. I didn’t see them all, but they were kind of fun. Then they moved on to the day’s first keynote by Lisa Guo & Hui Ding from Instagram. I hadn’t realized that they used Django and Python as their core technology.

They spoke on how they transitioned from Django 1.3 to 1.8 and Python 2 to 3. It was a really interesting talk and had a pretty deep dive into how they use Python at Instagram. It’s really neat to see Python being able to scale to several hundred million users. If I remember correctly, they also mentioned that Python 3 saved them 30% in memory utilization as compared with Python 2 along with a 12% boost in CPU utilization. They also mentioned that when they did their conversion, they did in the main branch by making it compatible with both Python 2 and 3 while continually releasing product to their users. You can see the video on Youtube:

The next keynote was done by Katy Huff, a nuclear engineer. While I personally didn’t find it as interesting as the Instagram one, it was fun to see how Python is being used in so many scientific communities and in so many disparate ways. If you’re interested, you watch the keynote here:

After that, I went to my first talk of the day which was Debugging in Python 3.6: Better, Faster, Stronger by Elizaveta Shashkova who works for the PyCharm team. Her talk focused on the new frame evaluation API that was introduced to CPython in PEP 523 and how it can make debugging easier and faster, albeit with a longer lead time to set up. Here’s the video:

Next up was Static Types for Python by Jukka Lehtosalo and David Fisher from the Dropbox team. They discussed how to use MyPy to introduce static typing using a live code demo as well as how they used it at Dropbox to add typing to 700,000 lines of code. I thought it was fascinating, even though I really enjoy Python’s dynamic nature. I can see this as a good way to enforce docstrings as well as make them more readable. Here’s the video:

After lunch, I went to an Open Space room about Python 201, which ended up being about what problems people face when they are trying to learn Python. It was really interesting and gave me many new insights into what people without a background in computer science are facing.

I attempted my own open space on wxPython, but somehow the room was commandeered by a group of people talking about drones and as far as I could tell, no one showed up to talk about wxPython. Disappointing, but whatever. I got to work on a fun wxPython project while I waited.

The last talk I attended was one given by Jean-Baptiste Aviat entitled Writing a C Python extension in 2017. He mentioned several different ways to interact with C/C++ with Python such as ctypes, cffi, Cython, and SWIG. His choice was ctypes. He was a bit hard to understand, so I highly recommend watching the video yourself to see what you think:

My other highlights were just random encounters in the hallways or at lunch where I got to meet other interesting people using Python.

PyCon 2017 – First Day Impressions

This is my first PyCon in 6 years. My last being in Atlanta. This year, PyCon is in Portland, OR. My first conference day I managed to miss the morning talks due to rooms getting overly full. So I ended up on the hallway track instead and got to speak with various members of the Python community. For example, I was able to speak with Al Sweigart, author of “Automate the Boring Stuff with Python” and Eric Matthes author of “Python Crash Course”. It was fun getting to know fellow authors.

Backing up a bit, the keynote was given by Jake Vanderplas and he spoke on how Python is used in science, specifically astronomy. It was extremely interesting and really neat that so many astronomy programs are using Python for data analysis.

For the afternoon, I spent some time working as a volunteer in the “Green Room”. These are the behind-the-scenes people who make sure the talks go off without a hitch. It was fun and pretty busy.. I met a lot of people and I thought that it went quite well.

My first talk was Nicole Zuckerman’s (@zuckerpunch) The Glory of pdb’s set_trace. She works for Clover Health and discovered that people were still using Python’s print() statement for debugging rather than using pdb. She is a huge advocated of using pdb’s set_trace() method. This method is useful for setting breakpoints in your code, traverse frames in a call stack, inspect variables, etc. You can read some more about pdb in Python’s documentation. Personally I like the debugger that comes with Wingware’s IDE, however pdb can be useful when you’re on a machine or remote server that you can’t use a more powerful debugger on. Anyway, this was an interesting talk that might be useful for people who need to learn more about the pdb module and how to use it constructively.

Educative Python Courses on Sale for PyCon!

I am putting my interactive Educative Python courses on Sale for PyCon this week. You can get Python 101 and Python 201: Intermediate Python for 50% off. Here are the coupon codes you can use:

Educative is also doing a 50% off sale on their Python 3: An interactive deep dive course which you can get with this coupon: au-pycon-deepdive.

And now for something completely different, Educative is offering a 17% off sale of their Coderust 2.0: Faster Coding Interview Preparation using Interactive Visualizations, so if you are interested in learning something a little different, now is your chance! Here’s the code for that: au-pycon-coderust

wxPython: Learning about TreeCtrls

The wxPython GUI toolkit comes with many widgets. A common control is a tree widget. wxPython has several different tree widgets, including the regular wx.TreeCtrl, the newer DVC_TreeCtrl and the pure Python variants, CustomTreeCtrl and HyperTreeList. In this article, we will focus on the regular wx.TreeCtrl and learn the basics of how to create and use one.

Creating a Simple Tree

Creating a TreeCtrl is actually quite easy. The wxPython demo has a fairly complex example, so I wasn’t able to use it here. Instead I ended up taking the demo example and stripping it down as much as I could. Here’s the result:

import wx
class MyTree(wx.TreeCtrl):
    def __init__(self, parent, id, pos, size, style):
        wx.TreeCtrl.__init__(self, parent, id, pos, size, style)
class TreePanel(wx.Panel):
    def __init__(self, parent):
        wx.Panel.__init__(self, parent)
        self.tree = MyTree(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize,
        self.root = self.tree.AddRoot('Something goes here')
        self.tree.SetPyData(self.root, ('key', 'value'))
        os = self.tree.AppendItem(self.root, 'Operating Systems')
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.tree, 0, wx.EXPAND)
class MainFrame(wx.Frame):
    def __init__(self):
        wx.Frame.__init__(self, parent=None, title='TreeCtrl Demo')
        panel = TreePanel(self)
if __name__ == '__main__':
    app = wx.App(redirect=False)
    frame = MainFrame()

In this example, we create a subclass of wx.TreeCtrl that doesn’t do anything. Then we create a panel subclass where we instantiate the tree and add a root and sub-item. Finally we create the frame that holds the panel and run the application. You should end up with something that looks similar to the following:

This is a pretty boring example, so let’s make something a bit more interesting. Continue reading wxPython: Learning about TreeCtrls