yesthattom: (Default)
[personal profile] yesthattom
I’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:
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.

Date: 2006-01-06 02:24 am (UTC)
ckd: small blue foam shark (Default)
From: [personal profile] ckd
Python is a time management tool.

How so?

Because I, and my co-workers, waste less time trying to figure out what the heck the person who wrote an automation tool was thinking, even (or especially) when the person reading the code was the original author.

(That's in addition to all the usual "automate away the annoying stuff" advantages: user creation, host database management, and many backup tasks are now handled in Python scripts.)

Date: 2006-01-06 03:32 am (UTC)
From: [identity profile] stitchinthyme.livejournal.com
The consulting company our group hired to build some new applications loves Python. They gave us some training in it, and it's not bad, but a lot of us kind of resented having to learn a whole new language just because the powers-that-be who signed the contract with them didn't bother to stipulate that they needed to write their code in a language that the employees (who will be maintaining the stuff when their contract is over) actually know. That's what happens when non-techies draft contracts like that.

Date: 2006-01-06 04:07 am (UTC)
cos: (Default)
From: [personal profile] cos
I was about to write a comment about how I don't understand what's cool about that, when I re-read your post and realized you meant % as the "operator" being overloaded, not print! It wasn't very clear :) Now that I see what you're saying, yeah, that's kinda cool.

Doesn't perl also automatically switch to big ints if integer values get too large, on architectures that support big ints?

Date: 2006-01-06 11:45 am (UTC)
From: [identity profile] krabbe.livejournal.com
“oh my god that’s so cool”


Yeah. You'll also have "OMFG why did they do *that*!?" moments. My learning experience (http://krabbe.livejournal.com/11684.html) was certainly littered with them (http://krabbe.livejournal.com/12994.html).

December 2015

S M T W T F S
  12345
6789 101112
13141516171819
202122 23242526
2728293031  

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Feb. 4th, 2026 04:24 am
Powered by Dreamwidth Studios