Next, yet another method of reversing/iterating backwards over a list has been suggested in multiple places, one which I didn't know about.

foo = ['one', 'two', 'three']bar = foo[::-1]

The only thing I can possibly say to that is... but the ternary operator is too obscure? C'mon, give me a break. This provides the ability to have tons of random line noise and make your code just as unreadable.

And, Seth: Since I couldn't catch you on IRC earlier, I'll just reply here.

Multiple issues to respond to, so let me break it down.

You seem to be confused as to what I was complaining about with list.reverse(). It's not that I want a copy of the list, exactly, but I want the return value of list.reverse() to be sane, which in my exceedingly humble opinion, it is nowhere near.

I'm not upset, mind you, just mildly annoyed, by the iteritems()/enumerate()/xrange() issue. And the reason that it's annoying to me is because it's inconsistent. Some of the iterator methods are global and some of them are not. Inconsistency is lame. End of topic.

Ternary operators seem to be quite the polarizing issue so I'll just leave my stance exactly where it is. I think they're useful, and I'd like to have them, but obviously I can work around the language not having them...

Especially since Python doesn't have sane scoping, either; the method-local and class-local scoping rules provide the opportunity for way too many obscure and annoying bugs. I note that you didn't respond to my issue with scoping at all.

Oh, also, a friend of mine has offered to send you a copy of the Smalltalk book, where he says that they solved the problem of doing lambdas and maps efficiently.

I'll kindly ignore your not-so-subtle digs at my programming ability (or perceived lack thereof) and refuse to insult you for liking Python. Mind you, I still think it's a useful language, but I'm just annoyed at the inconsistencies and some pet features (like ternary operators, or sane scoping) that I wish it had.

(This is a pretty geeky entry, so if you're not a geek, consider yourself warned.)I have a lot of little tiny annoyances with python, since I've been using it for a while now to hack on some stuff. Here's a collection of the ones that are floating on top of my brain.

::sniff::

I miss my ternary operator.

In C, and C++, and Perl, and Ruby, and PHP, and pretty much any language that I've ever written in (hell, I think even JavaScript supports this, though I could be wrong about that one since I haven't written any JavaScript code in years), you can use a very terse syntax for if (foo) { return bar; } else { return baz; } using what is referred to as the ternary operator.

The shortened syntax is more like:

(foo ? bar : baz)

Yeah, it's kinda weird. And yeah, if you don't understand it, it's not very intuitive. However, it makes for much shorter and clearer code (to those who grok ternary operators). Python doesn't support this. At all. There was a proposal to include it and it got smacked down, so that they could include such other genius ideas as reversed() instead. Speaking of which...

backwards

Reversing an array is done like:

foo = ['one', 'two', 'three']foo.reverse()

This does not return a reversed copy of the array, but it does reverse the array in-place and return 'None' which is quite confusing. Especially if you're used to sensible languages which return a reversed copy. So this code doesn't work.

However, this is a python-2.4-specific feature, so it's useless if you care about older python releases. Also, it doesn't create a reversed array, just hands you a pointer to a reversed list iterator. So you can't do:

Because bar is actually not a list, or array, or what-have-you, but it's a listreverseiterator object. Whatever the hell that's supposed to mean. What it translates into is basically "Surprise! We hate you."

So, you have to do:

foo = ['one', 'two', 'three']foo.reverse()for i in foo: print i

Which, granted, ok, isn't the end of the world, but it's pretty ugly and it doesn't work at all the way I had expected it to, which to me is the sign of a language that sucks.

For reference, the following code in ruby does work exactly how I expected it to. And because ruby and python share a decent amount of syntactical sugar, I keep on getting annoyed when things that I expect to be working in python simply aren't.

Ruby's list iterators are weird, sure. But actually, that's a good way to bring up my next complaint.

iterators in general

Why the hell do you have multiple types of list iterator methods in python? I shouldn't have to remember a different type of iterator method for every different type of container, nor should I have to remember whether it's a global iterator method or a per-container one. That's just annoying, and pointless.

for i, n in enumerate(foo): print i, n # Prints the index and the member

Although I have no idea why you'd want to. (You can always just do xrange(foo) and then 'foo[i]' since they give you the same thing. But ternary operators would be too confusing.)

But, if you have a dict instead of a list, all of a sudden...

foo = { 'a':1, 'b':2, 'c':3 }for i, n in foo.iteritems(): print i, n

Using enumerate() gives you the index of the 'a', 'b', and 'c' keys. Also, note that enumerate() is a global, like reversed(), but iteritems() is a member of the dict class type. This is the kind of inconsistency in a language that kills me.

white space

Surprisingly, I don't mind the whitespace thing. It just doesn't bother me that much. (Ok, so that's not really a complaint. Still, enough other people complain that I figured it was worth noting that it just doesn't irk me.)

scoping

Scoping is weird in python. Let me explain.In regular languages, a variable declared inside of a block of code only lives until the end of that block; this is the 'scope' of the variable. So if you have:

The other day, I was on Dell's website. They had the 2005FPW for 25% off, and I thought to myself, "Self, that's a damned good deal."

However, I didn't have $561.75 free on any of my accounts, and the deal expired in a few days. Then I saw the "Apply now" link. "Hmm, instant loan. Nah, you already have too much credit."

Wait, though. If you apply for credit and you get rejected, at least in the US, you're automatically entitled to a free credit report. What the hell, why not? I can always use a free copy of my credit report.

About three minutes later, the Dell website comes back with the result. "Congratulations! You qualify for a $1500 line of credit."

Shit.

Needless to say, now I have a sweet 20" widescreen LCD. It's gorgeous. I liked it so much that I bragged to pretty much everyone that would listen. And I even convinced ajax to buy one, but he went and bought three instead. Crazy bastard.

I'd post pics, but I don't have a digital camera. Mostly because when I buy one, I want it to kick ass, and the ones that I want are still over $1000.

[@ajax] so working on DRI for i128, i turned off XAA[@ajax] in the spirit of experimentation, i ran xcompmgr -a[@ajax] it feels _much_ faster now[@ajax] like, firefox doesn't tear when scrolling[@ajax] it's kinda weird[@daniels] hmm[@daniels] maybe we should rename it to XDA :P[@ajax] totally unaccelerated, but just fast enough to feel useful[@ajax] the only unpleasant part is switching desktops