Browse Category: Python

How I managed to make all cores work in unison

I was conducting this experiment about variance of sample. All I needed was a program that does a lot of calculations. So I did that and it took a long time. I didn’t even wait till the end since I knew that after 2 hours it will take at least as much as it took.

Task manager showed that only single core was being utilized. Fuck that shit! Why did I bought powerful machine if I couldn’t use it to it’s full potential?

But here comes asynchronous programming – my saviour.

Continue Reading

Variance of sample: decreased or not?

One beautiful day I was watching statistics lessons on Khan Academy about variance and standard deviation of sample. To give a quick intro, variance for population is defined by formula , but for sample, it is . You shall not get confused by notation, the only difference is denominator: for sample it is decreased by one. And Sal Khan, the teacher, encouraged me to try and see if it is true. I immediately figured out, that this could be done with not-so difficult program.

Follow me and I’ll show you how I done it!

Continue Reading

Data Structures in Python: tuples and sets

One thing that astonished me when I stated digging into the world of Python was it’s rich support for data structures. While PHP had only arrays (well, SPL allows much more, but who uses SPL?), Python has not only lists. While it supports things like bytearray and buffer, I was mostly attracted to tuples and sets.

So lets get going!

Continue Reading

PHP’s Array vs Python’s List

To begin with, I have never ever written a useful program that didn’t involve some kind of dynamic in-memory storage. Luckily, I do most of the work with high-level programming languages, so data structures like doubly linked list are long gone. 🙂

I will show you differences and similarities of PHP’s array and Python’s list for cases that appear everyday in my life. Prepare for reading some code and let’s go!

Continue Reading