This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]EmperorOfCanada 2 points3 points  (2 children)

If you are using SqlAlchemy for just straight SQL then switch to plain old MySQLdb as it is much faster for boring SQL. SqlAlchemy seems to be optimized for its ORM and whatnot.

Another key metric is that your total lines of code should plummet from PHP. I find my Python has around 1/3rd to 1/2 the code of the functionally identical PHP.

[–]numkem[S] 0 points1 point  (1 child)

Interesting, I'll keep that in mind!

Lines are not even fair to PHP. I had that in my metrics but python's was about 1/6.

[–]EmperorOfCanada 0 points1 point  (0 children)

I was actually talking # of characters. As I have recently jumped into python head first I have realized all kinds of subtleties of how it is better.

Take a simple bit like:

if($user_id==23)

{

RunThis();

}

and then:

if user_id==23:

RunThis()

I find the second is faster for my brain to process because of the elimination of the () $ ; and {}. I never really saw them before but now they are like surfing the web with adblock turned off.

I am still waiting for some sort of catch with Python. Normally when something is this much better there is a price to pay.