Python: A Long and Winding Road

Search for a command to run...

No comments yet. Be the first to comment.
The first full, official day of VMware Explore. I managed to attend a few sessions, as well as the traditional Welcome Reception and a couple after-hours events. In between I met folks both familiar and new. That's what a conference like this is abou...
![VMware Explore 2022: A New Dawn [Day 2]](/_next/image?url=https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1737277173084%2F27aa6c63-c1ff-4df5-8074-7bf666ef46fd.jpeg&w=3840&q=75)
Welcome to the VMware Explore US 2022 General Session live blog! General Session Only one general session this year, let's see what's up! Note: To view the live blog you need to read this post on https://teebeedee.org. If you read it some other way, ...
![VMware Explore 2022: General Session Live [Day 3]](/_next/image?url=https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1737277115028%2F62e1ebe4-7d09-46a8-8ac6-aca2c17e2487.jpeg&w=3840&q=75)
"See you next year San Francisco!" That's how my last post on this blog ended. It was August 2019. Simpler times. Needless to say I didn't see San Francisco in 2020. Or 2021. Two Gather(ings), Apart VMworld was held completely online those years. It ...
![VMware Explore 2022: The More Things Change [Day 1]](/_next/image?url=https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1737277227689%2Fe6cdc90f-c453-4673-afb3-9dba59700e47.jpeg&w=3840&q=75)
The bittersweet last day of VMworld. This year I'm doing something a little different and attending VMware's Future:NET. Future:NET is a sister conference to VMworld that focuses on networking. The day was broken down into sessions that alternated be...

Wednesday at VMworld. Full out sessions, last day of the Solutions Exchange. Let's check in. Swing and a Miss I had a breakout session booked early in the morning this morning. Early enough that I had to skip breakfast to get to it. No problem, I tho...

I first encountered Python several years ago when working on Oracle Virtual Directory, part of the identity solution supporting a then new Oracle-based web portal. Oracle Virtual Directory, or OVD, was designed to abstract multiple identity stores, whether they were native identity stores (LDAP) or not (databases), and make them seem like a unified directory. One of the "killer" features was the ability to merge, manipulate and otherwise bend the data to the clients' will. To achieve this, one of the main weapons in OVD's arsenal was a built-in scripting language that was a subset of Jython, the Java implementation of Python.
The use of Python as a scripting language proved very powerful, and while unfortunately my code didn't make it into production (due to the instability of OVD itself and not the code), it left an impression on me. I picked up Mark Lutz's Learning Python, 3rd Edition from O'Reilly (now up to a respectable 5th edition), with every intention of getting to know this language better. Alas, life intervened, as it does, and I only ended up a handful of chapters in before other distractions took hold.
Around the tail-end of 2014 I was casting about for something new to learn, and came across Programming for Everybody (Python) from Charles "Dr. Chuck" Severance on Coursera. The course was very beginner, non-technical-background oriented, because for Everybody, but I don't code often in my day job and wanted to ease back in any way. I really enjoyed the course and ended up enrolling in the Python for Everybody Specialization. It is a series of courses introducing you to Python, data structures, access web data (lots of JSON), and databases via SQLite. It culminates in a Capstone project where you have to combine what you've learned into a cohesive whatnot.
What did I come up with? A little program I called Get Sirius, which builds Spotify playlists based on now playing information on the SirusXM website. The now playing information is grabbed from an associated JSON file on the SiriusXM website, the song checked against a local SQLite database to see if it's a duplicate, and if not it's logged in SQLite and then fired off as a web request to an IFTTT Maker Channel that turns around and adds the song to a Spotify playlist.
In less than 100 lines of code. Including white space and comments. Yeah. I was hooked all over again.
In a line:
print "Hello World!"
What if that line, or lines, comes from a text file?
for line in open('file.txt'):
print line
Look how simple that is. How straight forward. A text file is opened and iterated through line-by-line, printing the contents out to the screen. In two lines of code. Two, easily read and understood, lines of code.
Because white space, especially indentation, must be used to end up with a usable program, Python code is actually easy to read. No tracking down curly braces or semicolons. For maintainability, or even starting out learning how various Python programs work, this is invaluable. Python has, effectively, embedded a culture of predictable communication into its specification. Powerful stuff.
Not to mention the abundant Python ecosystem, where there's a module for practically everything. This let's you focus on the core of what you're trying to do, minimizing time spent coding and maximizing time spent Making Things Happen™.
I want to learn more about Python and what I can do with it. I've picked up a few self-paced online courses which aim to help you learn by doing. The fantastic Talk Python to Me podcast acts as my weekly Pythonic anchor whether I've been able to get any coding time in or not. And I've got my eyes firmly fixed on VMware vSphere. Be wary, vSphere, you will be tamed with Python.
Watch this space.
Featured image photo by yukop