Why Python is so exciting for me
I’m in love with Python. Like madly in love. If I wasn’t pretty crazy about this one girl right now I’m sure that I’d probably start hanging out with Python more, take it out to dinner, get to know it better, you know how it is.
I remember when I first looked at Python and went “What in the hell, who would want to program in this?! No braces? Colons?? How do you read the code??” Eventually I grew to really love it and has become possibly my favorite to program in (on the same level as C#). I know some that will try to force their beliefs on others when it comes to languages and IDEs. I only want to share with you my excitement for this language. In terms of enjoyment though, I really do believe a favorite language is based on personal taste and people should respect that.
But why do I love it? I could probably go on and on about the exact features I like but that’d get a little repetitive. If I had to choose one thing I’d have to say the simplicity of the collections matched with their flexibility and power is my favorite feature. Also, the fact that there’s a library that pretty much does anything you want just one console command away doesn’t hurt either (with PyPI).
Python is also the first language I could just rattle out simple tools to serve my life with.
- Need to backup my PC? Built a backup script before packing up to leave for college.
- Need to run 20 files through some programs for school over the next 7 weeks? Wrote up a simple script to saves me hours of work in looking over the logs of the programs.
- My latest project with Python (pictured below) has been to tag all my music files. I just wanted the album and album art for my songs. The program corrects all needed searching fields, searches Discogs and Google for album info, and then uses an external program to get an image to embed in the mp3 all in just two days of work. Two Days!
# Try discogs search, list first few req = requests.get("http://www.discogs.com/search/?q=" + searchTextEnc) if req.status_code == 200: results =  album = None try: soup = BeautifulSoup(req.text, "html.parser") resEl = soup.find(id="search_results") for divEl in resEl.select("div.card"): #Try to get the artist and album try: foundAlbum = divEl.find("h4").find("a").string.strip() foundArtist = divEl.find("h5").find("a").string.strip() except: #Possibly no artist or album for given "card" continue results.append((foundAlbum, foundArtist)) if len(results) > 20: break except: results = None if results: #Display results for user to choose for i, (alb, art) in enumerate(results): printStr = "[" + str(i) + "] " + alb + " by " + art print(printStr.encode("ascii", "replace").decode("ascii"))
I tried a similar thing years ago with Perl for managing a large texture database. I was just not able to get the same speed or robustness from the program that I am akin to with my Python abilities.
While Python is my most recently learned language the speed at which I can code and the way the code fits with my mindset just works so well. While I do dread the ever nearing obsolescence date of any coding language that I use, I wonder if at some point in the future another language will be created that will top my enjoyment for Python.