Archive for the ‘Python’ Category

Learning Python

October 8th, 2008 by Sjan Evardsson

I was asked today “How do I learn python?” (I’m not making this up, that is a direct quote lifted right out of the chat log!)

Of course my first response was “start at python.org” (as it would be.) That is all well and good, but I started thinking about what specific things helped me? So, here are some specifics that might work well for you if, like me, you learn about half and half from reading (theory) and doing (practice.)

The first step, of course, is to download Python. You don’t need a fancy IDE to develop in Python, although if you have one you are comfortable with and use all the time, chances are that it has a Python plugin. (I know Eclipse does, and I believe NetBeans does, and jEdit has a Python client plugin that lets you run Python code right in the editor.) If you don’t want to muck about with an IDE, though, Python comes with it’s own lightweight editor, IDLE. Open it up, play around a bit.

Ok, so you’re looking at IDLE thinking “well, there isn’t much here is there?” You’re right - time for step two. Head over to the beginner’s guide and go for it! There are tutorials aimed at people who are new to Python and to programming in general, and people who are new to Python but not to programming. There is even a list of Python courses you can buy, and a fairly large list of introductory Python books for those who learn best that way. There isn’t much I can say that isn’t there already. I kind of wish that I had started there myself. When I started playing with Python I skipped over this and went straight for the documentation and googling for specific answers, as I was trying to build a script that I needed at the time to parse 1 -2 GB log files. Java was too much tool for the job, I didn’t have access to a beefy enough Linux box to do it in Bash and PHP was doing nothing but running out of memory. It made for a bit of a rough entry into Python, but I kind of like that sort of challenge.

Which brings us to step three - build something. No, not a “Hello World” app, but something useful, in the immediate sense. Something that will make you smile, or make your life simpler, or even something that will allow you to tick off an item on your to-do list.

So what (besides the end of my rambling in parenthetical asides) are you waiting for?

Python 2.5 Final released

September 19th, 2006 by Sjan Evardsson

Python 2.5 Final was released today. Get it!

Wow, and on International Talk Like a Pirate Day, too!

Tabbed Python editing with PythonCard

July 31st, 2006 by Sjan Evardsson

While I have been partial to IDLE for developing Python I recently came across on SourceForge while looking for some help building a Python GUI. While PythonCard has plenty of tools and examples to help with GUI construction, it was the Tabbed Code Editor that really got my attention.

One thing that I look for in any development environment is the ability to open mutiple files in tabs. While IDLE is extremely useable, it lacks this feature. And yes, there are other tabbed IDE’s that can parse Python syntax, but none of them seem to do as good of a job as IDLE.

While I can’t claim that the PythonCard tabbed editor is as good IDLE in terms of hinting and code completion, (at least as far as Python builtins) it does a rather decent job of that for objects/scripts that are imported.

While I may or may not end up actually building Python GUIs with it, PythonCard has definitely found a permanent place in my toolbox.

Another real-world turbogears example

February 9th, 2006 by Sjan Evardsson

Another real-world example of turbogears was pointed out by one my coworkers (thanks Brad!) and I had to check it out.

The Python devcenter blog on O’Reilly has an article on replacing Meetup.com with a turbogears app .

While I haven’t done any more at this point than quickly browse the source files and check it out in action, it seems like it is a good example piece. (I tend to better understand how things work by examining a few different examples.)

The app was developed by Rick Copeland of the The Python Atlanta “Meetup” group where you can see it in action.

Minor revision to breadcrumbs.py

February 6th, 2006 by Sjan Evardsson

I made a slight change to the I wrote as a plugin for . I changed the way the links are displayed, so that the directory seperators (/) are not included in the actual link, and added a rel=”tag” to the links to allow style aggregators understand them better.

As always, you are free to download it from this site and I am open to any hints, suggestions, fixes, updates, or constructive criticism of any sort.

Checking out TurboGears

January 22nd, 2006 by Sjan Evardsson

On the recommendation of Ted Leung (a former boss of mine and a font of programming wisdom) I decided to look into TurboGears. WOW!

I have seen all kinds of claims along the lines of “this framework is so special because . . .” - and well, most of them just don’t live up to it.

TurboGears does exactly what it says. It provides a means for rapid web application development. And as proof they provide a video that shows the creation of a wiki in right around 23 minutes, start to finish. It doesn’t get much better than that, now does it?

My First PyBlosxom Plugin!

January 10th, 2006 by Sjan Evardsson

Ok, ok, I know. It’s not a big deal. But it is to me!

I have been looking all over for the amazingly elusive breadcrumbs plugin for PyBlosxom
and found it nowhere. So, having the kind of attitude I do, I decided to try my hand at it. You can see the results in action on this site.

Prior to now, all the Python coding I had done was directly related to either server maintenance or parsing large text files.

If you would like a copy of my breadcrumbs implementation you can download it here.