Wednesday, October 1, 2014

Wednesday: Remember when it rained yesterday?

Guess which part of the ledge outside my window got wet.  Bonus points:  which part is slightly lower than the surroundings.
Reading Julie's post today reminded me why I hate python so much.  My initial thought to "how to call a shell script" is system.  Or backtics.  Since you probably care about the return results, backtics would work better.  I guess you could do an open on the command with a pipe to read from the output of the pipe, which is basically what backtics do, except the open is line-by-line.

But, of course, that's in the sane world of perl, so you google "python perl backtics," because this is obviously a question everyone would have.  Then you get this, and see that there's an os.system module that's basically the same as perl system, and os.popen, which is basically backtics.

Except os.popen is "obsolete," and you're supposed to use subprocess.Popen, which is "the correct way to do it."  Double except you probably should be using subprocess32 backport of the 3.2 subprocess.

Which is all bullshit.  Make a thing, make the thing do the thing, then leave it the fuck alone.  Don't keep re-engineering it "to be better."  Don't deprecate something and then come back with "oh, well, you should update your code to the newest version of things.  As far as I can tell, the only major removal between C from 1872 and the newest C11 standard are:

  1. Old functions that returned int didn't need to have that defined, as that was assumed.
  2. gets() is replaced by gets_s(), because gets() can cause buffer overflow issues that are major security issues.
That's it.  Like 139 years, and two things removed.  Perl is similar.  Remember when I mentioned the thousand ways to do this easy thing in perl?  I left out calling the IPC::Open2/IPC::Open3 modules.  Perl is ugly precisely because it's flexible.  There are legitimately five different ways to get the output of a shell script.  Why?  Because sometimes doing it way 1 is easier, sometimes you really need to use way 5.  Taking things out "because that's the wrong way" is how someone tells you that they think you're stupid, and that you need to do things the way they say you should.


I've noticed that a lot of the computer programmers I've met over the years seem to think that "just redesign it" is the solution to lots of problems.  Like there's an objectively perfect solution to every problem, and even though this solution works, it's wrong to not look for the perfect one.

Fuck that shit.  Sure, my Frankenstein monster bleeds from its eyes, and can only drown a child if it's also simultaneously pissing itself.  No, that was not the design.  I don't care.  I made a monster to terrorize the villagers, and if the details are a bit off but the villagers are still terrorized at the end of the day, I'm not going to complain.

  • This is why I think I have all the DVDs for the Superfriends show.  Because sometimes Green Lantern has three arms, sometimes Batman can fly, and sometimes everyone needs to go rescue Flash from the Legion of Doom, including Flash.
  • I'm not a big fan of elephants, but they do have this going for them.
  • Adventure Time.

No comments:

Post a Comment