Tag Archives: Python

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: https://pythonprogramming.net/. 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 nltk.org/book, 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.com (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,
                           wx.TR_HAS_BUTTONS)    
 
        self.root = self.tree.AddRoot('Something goes here')
        self.tree.SetPyData(self.root, ('key', 'value'))
        os = self.tree.AppendItem(self.root, 'Operating Systems')
        self.tree.Expand(self.root)
 
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.tree, 0, wx.EXPAND)
        self.SetSizer(sizer)
 
 
class MainFrame(wx.Frame):
 
    def __init__(self):
        wx.Frame.__init__(self, parent=None, title='TreeCtrl Demo')
        panel = TreePanel(self)
        self.Show()
 
 
if __name__ == '__main__':
    app = wx.App(redirect=False)
    frame = MainFrame()
    app.MainLoop()

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

PyDev of the Week: Anand Balachandran Pillai

This week we welcome Anand Balachandran Pillai as our PyDev of the Week! Anand is the author of a new book called Software Architecture with Python from Packt Publishing. He is the founder of the Bangalore Python Users Group (BangPypers) and a member of the Python Software Foundation. Let’s take a few moments to get to know Anand better!

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

I have done my engineering in 1998 – in Mechanical Engineering from the Indian Institute of Technology at Chennai. However I have never been a mechanical engineering even for a day in my life, as immediately after graduation I took up my first job in computer software.

Hobbies – I’ve been an avid trekker in the past, I still like to do it sometimes. Though more regular hobbies are the usual – listening to Music, Reading and going for long drives.

I’ve been an avid fan of Sherlock Holmes from younger days at school. A minor hobby is collecting Holmes stories and books in various languages. I even try his theories in real life on friends and family with variable success!

Continue reading PyDev of the Week: Anand Balachandran Pillai

PyDev of the Week: Agata Grdal

This week we welcome Agata Grdal as our PyDev of the Week! Agata is heavily involved in her local Django Girls group in Europe as well as PyLadies. You can learn more about Agata on the DjangoGirls blog. Agata is also has some fun projects on her Github profile that you can check out. Let’s take a few moments to get to know Agata better!

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

I have a Bachelor of Science in Mathematics, but I decided to pursue a Master’s Degree in Computer Science.

I’m the most proud of my community work. I am Django Girls contributor, coach and local organiser. I helped translate the DG tutorial into Polish, I co-organised two workshops in Wrocław and I was a coach in several others around Europe. I co-organised conference Django: Under the Hood in Amsterdam and was a part of organising team of local python meetup in my home city, Wrocław.

I’ve recently moved to Warsaw and joined Sunscrapers, a Python shop based in Poland, where I develop web applications using Django.

I am a big fan of sleeping, potatoes and cats. Besides work, my second passion is improv theatre. It’s all about listening, reacting, accepting, taking and giving. I encourage everyone to try it. Continue reading PyDev of the Week: Agata Grdal

PyDev of the Week: Jessica McKellar

This week we welcome Jessica McKellar (@jessicamckellar) as our PyDev of the Week! Jessica is a former Director for the Python Software Foundation and a successful entrepreneur. She is also an author for O’Reilly and has been a core developer for the Twisted framework. You can check out her website or her Github profile to get an idea of what she’s up to. Let’s spend some time getting to know her better!

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

I’m an entrepreneur, software engineer, and open source developer currently living in San Francisco. I’m a former Director for the Python Software Foundation, former organizer for the Boston Python User Group, and PyCon North America’s Diversity Outreach Chair.

I joke that I don’t ever take vacation — I just travel to speak at Python conferences. This has given me the opportunity to speak with and learn from local Python communities around the world. I’m grateful to have won the O’Reilly Open Source Award in 2013 for my outreach efforts in the Python community, which was really recognizing the long-term efforts of many talented people who I am also lucky to call my friends.

I’m currently a founder and the CTO for an early-stage enterprise software company, where I am delighted to be using and benefiting from Python 3 from the get-go. Previously, I was a founder and the VP of Engineering for a real-time collaboration startup acquired by Dropbox. Before that, I was a computer nerd at MIT who joined her friends at Ksplice, a company building a service for rebootless kernel updates on Linux that was acquired by Oracle. These diverse experiences got me onto the Forbes 30 under 30 class of 2017 for enterprise software just in time to age out of the category.

Continue reading PyDev of the Week: Jessica McKellar

Free Python Resources

There are lots of free resources for learning Python available now. I wrote about some of them way back in 2013, but there’s even more now then there was then! In this article, I want to share these resources with you. If I miss anything that you have found helpful, feel free to link to them in the comments.

Blogs and Websites

When I am learning Python, one of the first places I turn to is the official Python documentation:

There are also lots of other pieces of documentation that can be found on the Python website.

Doug Hellman has been producing a series called Python Module of the Week (PyMOTW) for years. He now has a version of the series for Python 3 as well. Here are the links:

There are two interesting “Hitchhiker” websites on Python, but I don’t think they’re related except by name:

DataCamp has lots of good free and paid content on Python for Data Science. They also have a neat blog with Python content.

If you are into reading blogs, then Planet Python is for you. Planet Python is basically an RSS aggregator of dozens of Python blogs. You can see links to each blog that is aggregated on the left side of the page.


Free Python Books

Mark Pilgrim’s books have been online for over a decade. He created two versions of Dive Into Python, one for Python 2 and the other for 3. I’m just going to link to Python 3 here.

Al Sweigart has been putting out Python books for quite a while as well. His latest Python book is Automate the Boring Stuff with Python. It’s a fun book and well worth checking out. You can see his other books over on his website. They are all available for free, but you can purchase them too.

WikiBooks has a Python 3 book called Non-Programmer’s Tutorial for Python 3 that is still recommended.

While I’ve never read it, I have heard that Full Stack Python is good.

If you’d like to learn Test-Driven Development, there’s a book for that too over on Obey the Testing Goat. I will note that this book is heavily focused on web programming with Python and how to test that, so keep that in mind.

There is a neat online book called Program Arcade Games with Python and Pygame that is available for free in multiple languages, which is something that the previous books just don’t offer.

Finally I thought I would mention my own book, Python 101 which is available for free or pay what you want over on Leanpub.


Wrapping Up

There are tons of other free resources and books on Python too. These are just an overview. If you happen to get stuck in any of these books or resources, then you will be happy to know that there are a lot of helpful people on the following websites that will answer your questions:

Have fun learning Python. It’s a great language!