david wong

Hey! I'm David, cofounder of zkSecurity and the author of the Real-World Cryptography book. I was previously a crypto architect at O(1) Labs (working on the Mina cryptocurrency), before that I was the security lead for Diem (formerly Libra) at Novi (Facebook), and a security consultant for the Cryptography Services of NCC Group. This is my blog about cryptography and security and other related topics that I find interesting.

Faster Python posted December 2014

Zokis wrote some tests on python, showing that a difference in declarations and simple syntax do have implications in the size of the program and the rapidity of execution.

For example writing a, b = 0, 1 seems faster than doing a = 0 then b = 1 Using chained conditions like a < b < 0 seems faster than doing a < b and b < 0 etc... you can find all the tests here

The differences seem negligible though. dis and timeit were used to quantify the tests.

Also here are two useful python arguments:

python -c cmd : program passed in as string (terminates option list)

# python -c "print 'haha'"
haha

-i : inspect interactively after running script; forces a prompt even
if stdin does not appear to be a terminal; also PYTHONINSPECT=x

# python -i -c "a = 5"
>>> a
5
Well done! You've reached the end of my post. Now you can leave a comment or read something else.

Comments

leave a comment...