Patrick's playground

Random thoughts, problems and solutions

Tag: Python

Python: check for substring speed

I was looking for options on how to check if a certain substring (in my case ' FROM ') is present in a SQL query string when I found this blog entry. Just for fun I decided to have a look at how fast these checks would be compared to each other.

Read More

Getting IPython readline and auto-completion to work on Mac OS X

It's taken me some time and a lot of web pages which tried to solve the readline support with all kinds of hacks, but finally I've been able to get readline support and auto-completion for IPython to work. As it can be quite confusing and hard to follow all posts, this will be a step-by-step approach to get things to work. Note that I've got it working on Mac OS X 10.5.7 Leopard. It is expected to work on Leopard at least. Other versions might not require the exact same solution.

Read More

Python ParserFactory

Yesterday I had an idea about how to manage parsers in dynamic way. My idea was like this

  • A managing class can access the parsers folder and check which parsers (files) are available
  • A parser describes which file formats (and which versions of it) it can parse
The result should be that parser classes are implementing a parser interface and a ParserFactory can get info from the available parsers. As I have been working with Java, PHP, Haskell and some other languages, but rather new at Python this is an interesting problem to get to know Python a little better.

Powered by WordPress & Theme by Anders Norén