The snake bites it's tail

I have finally hit some sore points in my Python programming experience I don't like at all:

Point nr 1: How Python handle NULL values. I am of course not the first to hit this little problem... This is particularly confusing when dealing with databases. A DB query could return one field in one row of which the value is NULL, or, no rows could be returned at all. In both cases you will have a "None" condition, but you need some logic in your app to figure out the where and why you get the "None". Very irritating indeed...

Point nr 2: Then there is the MySQLdb problems, like the BLOB problem noted here... Only, I got the same issue on BIG INT values as well. From the status of the noted problem you will note that the maintainers of the MySQLdb module does not intend fixing this, so again you need a lot of application side logic to deal with these problems.

Point nr 3: I still long for the way Perl deals with variable types - just have scalars, arrays and hashes - nothing else. I am ending up converting almost all output of variables to strings using the str() function, as you just don't always know when a variable is not a string. The annoying part is that it doesn't always work - refer to point 2. Of course this adds more CPU calls and still more logic you need in your application to deal with all these strange things.

So what is one to do?

Well - I will probably have to write my own wrapper module around MySQLdb in order to get the values I want in the way I want it, and hide all the complexities in the wrapper module.

Watch this space...

Comments: Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?