Critiquing my first Python script

Posted by tipu on Stack Overflow See other posts from Stack Overflow or by tipu
Published on 2010-05-03T17:01:27Z Indexed on 2010/05/03 17:48 UTC
Read the original article Hit count: 354

Filed under:
|
|

A little bit of background: I'm building an inverted index for a search engine. I was originally using PHP, but because of the amount of times I needed to write to disk, I wanted to make a threaded indexer.

There's a problem with that because PHP is not thread safe. I then tried Java, but I ended up with at least 20 try catch blocks because of the JSON data structure I was using and working with files. The code was just too big and ugly.

Then I figured I should pick up some Python because it's flexible like PHP but also thread safe. Though I'm open to all criticism, what I'd like to learn is the shortcuts that the Python language/library provides that I skipped over. This is a PHP-afide Python script because all I really did was translate the PHP script line by line to what I thought was it's Python equivalent. Thanks.

http://pastebin.com/xrg7rf9w

© Stack Overflow or respective owner

Related posts about python

Related posts about critiquemycode

  • Scala n00b: Critique my code

    as seen on Stack Overflow - Search for 'Stack Overflow'
    G'day everyone, I'm a Scala n00b (but am experienced with other languages) and am learning the language as I find time - very much enjoying it so far! Usually when learning a new language the first thing I do is implement Conway's Game of Life, since it's just complex enough to give a good sense… >>> More

  • Critiquing my first Python script

    as seen on Stack Overflow - Search for 'Stack Overflow'
    A little bit of background: I'm building an inverted index for a search engine. I was originally using PHP, but because of the amount of times I needed to write to disk, I wanted to make a threaded indexer. There's a problem with that because PHP is not thread safe. I then tried Java, but I ended… >>> More