Showing posts with label Python. Show all posts
Showing posts with label Python. Show all posts

Saturday, February 27, 2021

Learning Python

 I stumbled across what appears to be a great resource for learning Python. It's been over a decade since I've known I need to learn Python. During that time I have taken a Coursera course and written a few scripts here and there, but I still do most of my Python programming by Googling and searching Stack Overflow. That works okay for occasional use, but I have recently found the need to make Python my daily driver. So I went in search of some solutions in the fall. 


I started by looking for something that I could use on my phone. Python Programming: Ultimate guide looked promising, but my enthusiasm for their app waned as I an into some technical difficulties. I should go back and revisit that, though. 

Eventually I found Python Morsels, and I think this is what I need in my life right now. I did the free month-long trial in the fall and I just signed up for a year. The site is created and maintained by Trey Hunner, a Python trainer for teams. I'm still fairly new on my journey there, and he just introduced a new "flexible mode," but the basic structure seems pretty well established. He gives an assignment, reference hints, automated verification, and follow-up discussions of the solutions. I highly recommend it.

The new "flexible mode" sets up a profile that can be made public. Mine's not that interesting, but I expect it will become more so over this next year!


3/11/21 Edit: I just noticed that Trey is a contributor to EditorConfig and his name is on a bunch of the plugins.

Friday, October 1, 2010

Python

Yesterday I wrote my first python script:
os.system('lookAtStuff.pl')
Awesome, no? Alright, that was not really the script. I have used perl as my scripting language of choice since High School.

My current manager has been trying to convert me to python for many months. The problem has been that I only use a scripting language when I want to do something quick, and if I want to do something quick I do not want to learn a new language before it gets done. That is kind of lame excuse, but it is all I have.

There are really two powerful features in perl that keep me coming back. Yesterday, I dug around and found out how to do those features in python.

  • Regular expressions - I spent a summer writing regular expressions to tag corpora for Kurzweil Applied Intelligence (right after they were sold to Lernout & Hauspie). Since that time I have used perl's regular expressions extensively. At first glance, python's regular expressions are a bit clumsy and awkward, but at least it has them. I found the official documentation very useful. The main tricky points being the "The Backslash Plague" and using search instead of match. I think they did that just to be ornery. Python has to "compile" the regular expression before using it, but I am used to that from C++.
  • System commands - I normally use my perl scripts to glue together other programs or batch runs together. I have perl call these other programs directly, and sometimes I pipe in the output as a file. Python can do that to, but (like regular expressions) it feels a bit clumsy and awkward to me. The official documentation is useful. For my little script I used listdir and popen. I expect I will use the system command in the future.
I have so far found printing in python to be a nuisance, but I also have not had any kind of epiphany there yet either. I expect that after I use it for a while I will "see the light."

That's my $0.02, and my journey in the world of python has officially started. Know of any quality, free, online, and concise references for Python?