Posts where I used the Python programming language and thought that was interesting.
tags → python
Jul 9, 2017
Miguel Grenbergs’ Flask Mega-Tutorial and book helped me understand using Python’s Flask microframework. Well, somewhat. My understanding would improve if I used it more. Haven’t taken advantage of the opportunity yet. Anyways - of course I decided to back his Kickstarter for updating the Flask Mega-Tutorial.
Jul 4, 2014
I have been spending much of my coding time in Python recently. This site is built in Pelican. Many lines of Python have been written for work. I have even been poking at Google App Engine in what spare time is available. The only disappointment is that all of these have been in Python 2. I would prefer to be using Python 3. There is a little free time today, so I will set up a nice Python 3 workspace.
Jun 10, 2011$ sudo apt-get install ipython $ sudo port install py27-ipython $ alias ipython='ipython-2.7' $ ipython Python 2.7.1 (r271:86832, May 18 2011, 11:05:32) Type "copyright", "credits" or "license" for more information. IPython 0.10.1 -- An enhanced Interactive Python. ? -> Introduction and overview of IPython's features. %quickref -> Quick reference. help -> Python's own help system. object? -> Details about 'object'. ?object also works, ?? prints more. In : exit() Do you really want to exit ([y]/n)?
Jun 7, 2011 (Updated Jun 16, 2011)Introduction If you have never programmed before in your life, then do I have the perfect programming language for you. It’s called Python. It is easy to learn, flexible, and loaded with capabilities that you never thought would be so easy to use. Imagine your thrill when you write a complete program in just a few lines! If you have spent years programming Perl, and are just about sick of all of the weird little context dependencies (“My function does this when you hand it a single object, and that when you hand it a list, unless you are assigning the result to a list, in which case it does this other thing”), then do I have the perfect language for you.
Jun 12, 2009
I had to focus my efforts last time on restoring the original functionality of my Python Blogger script. That’s out of the way. I can now start looking at enhancements. The first annoyance - of many - is the fact that Blogger connection settings are hard-coded into the script. Do you want to post to a different blog? That’s going to require editing the source.
Jun 9, 2009 (Updated Jun 12, 2009)
I wrote a post a while back about using Python to write Blogspot posts from the command line. It took me about two weeks to completely forget about it. Still, it’s one of the few posts on this blog that gets regular visits, and the code … well, the code is not great. It was a fair effort, but it didn’t even accomplish the things I had initially set out to do. Account information is hard-coded into the code, for example. I also blundered along haphazardly with parsing metadata information myself despite the fact that Python Markdown has an extension which is perfectly capable of handling metadata. Well, let’s look at that code again.
Jun 14, 2007 (Updated Jul 11, 2009)
This is Part 3 of an ongoing series about writing interactive fiction games in Python. By the end of Part 2 we had created a text-based user interface and explored one way of storing multiple scenes. This part will finally bring the needed glue for the player to move between all of the scenes in the story. In other words, we’ll have a game!
Apr 20, 2007 (Updated Jul 11, 2009)
This is the second part of an ongoing series about using Python to create interactive fiction. I hope to show you one fun use of Python while teaching you more about the basics of this language. We started by defining how our game was going to work and creating a set of scenes for play. Next we wrote the code to handle a single round of the game. Today we are going to tie all of our scenes together to make a complete, playable game of interactive fiction. We are going to approach it from an experimental view, playing with different approaches until we find one that makes us happy. Well, one that makes me happy.
Apr 19, 2007 (Updated Jul 11, 2009)
I think the next step is to write the code for a single round of the game. We’ll limit ourselves to Scene 1 to stay focussed.
Jul 11, 2004 (Updated Jul 11, 2004)
There are several different approaches to programming, but the one that is easiest for me to grasp is imperative programming. The imperative approach allows you to tell the computer exactly what you want it to do and how you want it done. The best analogy I can think of is a cooking recipe. You have a list of ingredients and a specific set of instructions to follow. Veer from the recipe and you may not be happy with the results. Veer too far from the recipe and your house could burn down.
Jan 17, 2001 (Updated Jul 11, 2009)You may have already heard me say that I do not have a favorite programming language. That’s true. However, if you want to learn how to program - if you have never programmed before in your life (except maybe some QBASIC several years ago) - than Python sticks out way way ahead of the others. It is easy to get started, it is consistent across most operating systems, and you can make your programs as big, elaborate, and “real-world” as you want.