#12in23 01: Python

Cover image for #12in23 01: Python

I heard about the #12in23 challenge from Exercism at the end of last year and decided to participate. I'm looking to make a career change out of marketing sites and into ... well, something different. I'm open to options. With that in mind, I thought some exposure to new programming languages and paradigms would be good for me to explore and dive into what's out there.

The first language I chose was Python. I figured it's a similar style to javascript, so it wouldn't be too hard to get started. It's used a lot at my day job (though not much by my team), and with all the AI/ML stuff happening, it seems prudent to get better at Python.

How Did I Learn Python?

As this challenge is created by Exercism, I spent a lot of time working through the Python track. I have completed 63 exercises so far, ranging from prime number calculations to converting numbers between different bases. I thought Exercism provided a really nice variety of exercises that introduced me to many important Python concepts, both explicit and subtle.

In addition to the exercises, I also put Python into practice IRL. I built a web crawler for a work project using Scrapy that scraped site content for me to convert into WordPress. Another great use is CSV manipulation and analysis. I regularly use Screaming Frog to crawl various aspects of websites, but the CSV you get back is massive for a site with many pages. I realized that Python has excellent utilities for cleaning up and manipulating this data, and now I have a small library of utility scripts I can run on these files.

The last thing I tried out was Django. I'm working on a habit/goal tracker as a small side project and figured I'd give Django a go since I've worked with several other web frameworks. While I was able to dive in a build a proof of concept, I think I'll stick to Laravel for now. I prefer a more opinionated framework with known conventions to follow, especially when I'm just working on a small project. In my opinion this makes maintainability much easier.

Pros and Cons of Python

While a month isn't enough time to have deep opinions about any given language, for me there were some definite pros and cons I'd like to highlight.

Pros of Python

The biggest pro of python is how easy I found it to grok and start using. I'm used to scaffolding an entire server and project to work on anything, so the concept of writing a simple script and executing it right on the command line was thrilling. I understand now why Python is such a popular language for automation-type tasks.

Another benefit is all the libraries. There is a library for everything! I have found all sorts of utilities for CSV scripting, and numpy is insanely useful for analysis tasks. The last thing I want to call out is the idea of having sets, where each item is unique. I love this complement to a traditional array/list, and it's awesome not to deal with reducers in order to get a unique set of items.

Cons of Python

I haven't spent enough time with Python to call it out for too much, but I did find a few negatives. One is the lack of block-level variable scoping. I am used to having multiple levels of variable scoping, and Python's lack threw me for a loop. Another negative was that Python seemed to get exponentially slower the bigger the files/projects I threw at it, with little room for optimization.

Will I Keep Using Python?

Absolutely! It's my new go-to for data processing, dealing with file cleanup, scraping, and general utility tasks. As I dive deeper into math, analysis, and ML, I'm sure I'll spend more and more of my days using Python. I doubt I'll use Django again. I prefer some other frameworks I'm already more familiar with.

What's Happening Next?

I hope to return to school for a master's next year, so I plan to focus on some of the more "computer science-y" languages next. February will be all about C since I'm working through the Harvard CS50x class, which uses C for several weeks.