Floating Point Arithmetic: Issues and Limitations
About once a week or so, someone will post to c.l.py, reporting as a bug the fact that 0.1 is showing up as 0.10000000000000001. This isn't a bug, it's just the way that floating point works. There is nothing peculiar to Python about this behaviour, either - any floating point implementation will show some variation on this behaviour. Java, RPG, C#, VB, you name it.
In a (so far unsuccessful) attempt to have this 'bug' reported less frequently, Tim Peters added this appendix to the Python Tutorial. It's worth a read whatever you code in.
In general, then, business oriented software should avoid using floating point, and should certainly never use it to store currency values. For that you shoud use FixedPoint or java.math.BigDecimal, or the like.
5:15 p.m., and I'm the last one here. UK working hours rise sharply? Not here!
I'm pretty much honour-bound to start downloading hardcore pornography at this point, I'd say. Any suggestions? ;-)
Are Programmers People? And If So, What to Do About It?
Ken Arnold on human factors in programming language design.
Naturally, in a discussion about why programming languages are crap, Python is bound to be mentioned as a counter-example!
Via Ned Batchelder.
The girls wanted to see the S Club film this weekend. Sigh.
What can I say? Freja (6½) loved it. She got most of the jokes. (Though thankfully not the vibrating egg one - which I felt was rather out of place, to be frank.)
Ella (4¾), though, was all at sea. The plot, such as it was, involved a set of clones of the band. Every thirty seconds or we had "is that the real one, or the robot, Daddy?" Bless her.
The music was unadventurous but workmanlike pop, as you'd expect. Again, Freja loved it. As you'd expect - she's pretty much their target audience
On the plus side, that Rachel Stevens scrubs up OK, it must be said.
And it was ten times better that The Jungle Book 2! A real stinker. Three reprises of the The Bare Necessities - and when you heard the new songs, you know why they made so much of the old ones. Avoid.
Oh, it's Ella's first day at school today. Good luck Ella!
The Future of Programming on the iSeries, Part 1 and Part 2.
Some interesting history here, but no real news. According to IBM, RPG III is strictly legacy, and RPG IV must coexist with Java.
My, I'm inclined to doubt that many new systems will be written using any RPG at all. Though the developpment tools are improving, RPG itself is still a pig. My current company is a '400 shop, and our main product is in RPG III, but even we haven't written a new system in any flavour of RPG for some years. There is still plenty of maintenance and enhancement work for the RPG people, but it's strictly legacy stuff.
And if you are a '400 developer, and you don't know Java yet, then now is the time.
Some other iSeries stuff:
Python 2.3 Beta 1 is out.
A.M. Kuchling has put together his usual What's New in Python 2.3 document.
I particularly like the inclusion of the logging and csv modules in the standard library. I already use both of these, so I'm glad they are now the standard.
Also good - the string method changes. One of these was my feature request - the optional arguments on the strip method and its siblings. This was backported to 2.2.2 - it was added to the string method, but not to the string module function, though the documentation incorrectly said that it was added to both. Given the frequency with which this comes up on c.l.py, it seems that this is a much-used feature already!
I'm also keen on extended slices, importing from zip archives (i.e. JAR files for Python), and the if 'fred' in 'bill and fred' thing.
Generators are now enabled by default - I've been using these a lot.