Archive for Rants

Python 3: print or print()

There’s a thread over on the Python list which started a week ago as I write and is still running. The OP titled his post the provocative “I strongly dislike Python 3″ but what it really comes down to is “I strongly dislike print()”. Various people have come in on both sides of this well-worn argument.

Now, I don’t really mind futile discussions, and this clearly is one: Python 3 isn’t going to switch back, no matter how many people weigh in on the print-as-statement side. I’m in that camp myself, and when the matter was first up for discussion I had a to-and-fro with Alex Martelli on the subject which I backed away from fairly quickly. I continue to enjoy and benefit from Python regardless; I contribute to its development very slightly and very rarely; and even were I the most prolific contributor on the planet, I don’t believe that would give me any particular right to dictate design decisions of this sort. You take the rough with the smooth.

I think the side of the discussion which irks me the most is from those who are defending the print-as-function decision. Clearly there are cogent and persuasive reasons why print should be / should have been a function. No-one’s pretending that this was a decision taken randomly and for the sake of change. Or even for the sake of a foolish consistency. But if someone’s working practice involves using print a lot — perhaps in the interpreter rather than in a code editor — then the switch to the function version is clearly a burden. It may be more or less of a burden, but it involves having to do something which you didn’t have to do before. Being told that you should have been using logging or pdb or sys.stdout.write — all of which are valid tools to use in the proper place — doesn’t really make your life any easier.

So while Python 3 is now the default interpreter on my shortcut keys and I’m trying to write new code against 3.2, I still find it a pain to overcome the very long habit of, eg, print ad.find_user ().sAMAccountName. Obviously if Python 1.5.2 had had print () as a function originally, I wouldn’t find is so hard now. ;)

(As an aside I did wonder at first whether the American or some other non-UK keyboards had the brackets in some more convenient spot, but it doesn’t appear so…)

Compare and Contrast

I’m not an open source bigot, although I do like to use it where I can. But it doesn’t look as though the government’s that interested in pursuing non-commercial solutions, does it?

Disabled badges

I work in Camden Town in the north of London, a mecca for youngsters shopping for the more outlandish kinds of outfit, and one of the most difficult places in the known universe to park in. Jamestown Road, just off the Camden High Street, is a popular spot for parking with a good view of the pay-and-display machine. Of course, if you’re entitled to a disabled person’s badge then you or your driver can park without paying (within certain restrictions). Now there’s obviously nothing to prevent someone who’s disabled in some way from being the owner of a fast and expensive sports car. But when you see three or four of them a day parked along the road, proudly sporting their Blue Badge, you stop and wonder…

… and sure enough, there are periodic newspaper reports of a thriving black market in Blue Badges. Obviously, there are greater threats to humanity, but you do wonder whether the veritable swarm of traffic wardens which Camden Borough appears to employ for no better purpose than to maximise their income from parking revenues might not be employed to better effect by standing by Blue Badged cars and waiting with a video camera for the entirely able-bodied driver to show up!


Warning: this post will mean nothing to you unless you live or have lived in London. It may — and this is entirely the point — still mean nothing to you even if you do!

It boggles me how many people — including, apparently, professional sign-writers — still think that London is divided into two telephone codes: 0207 and 0208. Having lived through the 01/081/0181/020 debacle, I entirely understand where the misunderstanding comes from. But it’s been nearly ten years. And there are otherwise intelligent people of my acquaintance who refuse to accept my explanation that all London numbers are eight digits long and have the exchange 020.

Wherefore art thou misquoting?

Not really a misquote, since the quote itself is generally perfectly accurate (mutatis mutandis). Rather a misunderstanding of what the quote means. In my experience, nine out of ten people who say “Wherefore art thou, Fred?” think that they are using some sort of Shakespeare-speak for “Where are you, Fred?” and completely miss the point that “wherefore?” means “why?”. Juliet is not asking “Where are you Romeo?” but rather “Why are you Romeo?” … and not someone else with whose family my own family is not at daggers drawn.