Learning Python
Jan. 5th, 2006 09:04 pmI’ve decided to not read LJ for a week and instead use that time to learn the Python programming language. If there is something you specifically want me to see, please email it.
I may be posting little “oh my god that’s so cool” kind of ramblings. Here’s an example:
Rather than having to bother with sprintf like in C and perl, they have a freakin’ brilliant idea to overload an operators to mean “format this with printf-style formatting rules”. So if you do:
And having infinite precision integers (if the value is larger than 32-bits, it starts using a “big int” library to manage the values) as a first-class citizen is just so cool.
I may be posting little “oh my god that’s so cool” kind of ramblings. Here’s an example:
Rather than having to bother with sprintf like in C and perl, they have a freakin’ brilliant idea to overload an operators to mean “format this with printf-style formatting rules”. So if you do:
print “%4.2f” % 3.1412
it formats as if you had done this in perl:print sprintf( “%4.2f”, 3.1412)
(Obviously you could use “printf” instead, but this is just a demo).And having infinite precision integers (if the value is larger than 32-bits, it starts using a “big int” library to manage the values) as a first-class citizen is just so cool.
no subject
Date: 2006-01-06 03:32 am (UTC)