python anti-rant

April 15, 2005

Looking at clee’s not-so-obvious complaint against python I see a couple of issues.

foo = [‘one’, ‘two’, ‘three’]

foo.reverse()

for i in foo:

print i

His complaint is that this is un-intuitive to him. So I’m a bit confused. Why would I make a new list just to get the current list reversed? It seems more intuitive me that you want something done to the list then you call the method of the list object that performs that item INTERNALLY to the object. Why should the reverse() method also return the list. I only told it to reverse it. This seems MORE intuitive to me than the way perl or ruby are handling it b/c perl and ruby are both doing:

reverse() == reverse() && return()

He is also upset b/c for dict objects it seems inconsistent for python to have iteritems() be an available method. I think this has more to do with the implementation of iterators after python 2.2 and less to do with any goals in the language. Moreover for getting a simple list of dictionary keys or values he could, of course, just use dict.keys() or dict.values().

Finally, he bemoans the lack of a ternary operator. I think the lack of ternary operator is a plus. It just means we do not have an operation with no keywords just floating separated by random line noise. I consider it a readability benefit.

If only we can find another way of writing lambdas and maps that were as efficient as lambdas or maps we’d be rid of the next ugliest operation.

All in all his complaints seem summed up by: “I’m used to other languages that go out of their way to make things terser and more confusing by using random line noise characters therefore I’m confused by a language that makes readability a priority.”

It’s a shame when an otherwise perfectly good programmer is broken by other languages.

Icon hates &

April 14, 2005

Just to piss off icon.

Not quite-closing the div

🙂

update: closing the div b/c I’m a nice guy

Application requirements

April 5, 2005

Reading through Daniel’s post about being beaten up about libxml2’s interface I have two responses.

my first response is sympathy – I’ve been there, I get beaten up all the time about yum not doing something as well as something else and why I even bother if I don’t provide X feature.

Yah, it sucks, but it’s not for that subset that you often do things.

My second response, though, is that this is how things work. Sometimes one library is better for the job than something else. It doesn’t necessarily mean that one is definitively better in all possible ways. Hell in this specific case it is cElementTree vs libxml2. No one is even remotely claiming cElementTree can do all the things libxml2 can. We’re just saying that for what we need cElementTree works a little bit better. The post was not terribly hurtful it just described the reasons for the decision to move to cElementTree.

To be clear, though, when someone is criticizing volunteer work it should
be in one of two modes:

  1. kindly, constructively, patches often accepted
  2. sympathetically ie: I know this isn’t what you’re looking to do, but it’s what I needed to do
    and this is why I did not do it the way you wanted.

I think a good deal more politeness would go a long way to easing these
sorts of problems.

Anyway, my point is that this has been what’s driven development. I know I’ve been spurred on in yum by items in smart and apt and urpmi and red-carpet that show up. I sometimes don’t agree with them, but they get me thinking about other ways of dealing with the problem. I will sometimes argue against adopting the other systems if I think the reason for adoption is wrong/bad, but I’ve tried (sometimes unsuccessfully) to not feel personally insulted b/c of a decision like this.

In general, I find maintenance of a widely-used open source program to be something that puts you out there and opens you up to critiques, flames and ridiculous praise, too. You have to ask yourself, why do you maintain it once it goes beyond ‘scratching your itch’. If you can’t find a good enough reason then sometimes it’s time to move on. I get infuriated at yum development on many occasions, still, but if it didn’t make me happy to see it being used so much I definitely would not still do this stuff.