Python
Python: checking for an empty string


There are few tricks, that may do your Python code even faster. For example, the task of finding if a string is empty or not is not trivial as it seems. Would you like to find out?

Comments [0]
Python: comparing with None


Python's documentation states that one has to use is operator co compare a variable with None. What happens when you avoid that advice?

Comments [0]
Inside Python: understanding os.listdir()


If you've been using python for a long time, then you surely know that os.listdir() function returns an unsorted list of file names.

I didn't care much untill I faced a situation, in which the sorted-sequential processing of files was crucial, and I could not remember whether the previous file processing were done in sorted order. Well, luckily they were. But hey, this is a little bit annoying, isn't it? Why os.listdir() returns an unsorted list of files? Would you like to find out?

Comments [0]
Inside Python subprocess communication


Sometimes, it's really hard to understand what happens inside a function or even a whole module of Python's Standard library. For example, the subprocess module contains a very tricky Popep class. I tried to use the the module to communicate with a MATLAB subprocess shell (e.g. send MATLAB commands to subprocess and read the output). Unfortunately I failed and was just able to pass a MATLAB script via command-line arguments. Yet, I learnt much about Popen.communicate() method and I'd like to share this knowledge with you.

Comments [4]
Python classes: Dynamic properties


Python never stops surprising me. While doing my master IT project, I was looking for a way to add dynamic properties to classes (we're speaking of new-style classes of course!). I did a little research and here are the results:

Comments [2]