<?xml version="1.0"?>
<!-- RSS generated by pyblosxom-1.0.0 -->

<rss version="2.0">
  <channel>
    <title>Chris Lee</title>
    <link>http://c133.org/blog/</link>
    <description>all clee, all the time</description>
    <webMaster>clee@kde.org</webMaster>
    <managingEditor>clee@kde.org</managingEditor>
    <language>en</language>
  <item>
    <title>ow</title>
    <link>http://c133.org/blog/personal/ow.html</link>
    <pubDate>Wed, 27 Apr 2005 13:53 -1000</pubDate>
    <description>&lt;p&gt;strep throat sucks. I&apos;ve had this soreness in my throat since Friday last week, and it kept getting worse. Finally, on Sunday, I went to the doctor and found out &quot;Hey, you&apos;ve got strep!&quot;&lt;/p&gt;&lt;p&gt;Now I&apos;ve got penicillin and cough drops. Throat still hurts. Wish my white blood cells weren&apos;t such little bitches. They&apos;re supposed to *handle* this stuff for me, dammit.&lt;br /&gt;&lt;/p&gt;</description>
  </item>
  <item>
    <title>rant part deux</title>
    <link>http://c133.org/blog/tech/rant_part_deux.html</link>
    <pubDate>Fri, 15 Apr 2005 19:14 -1000</pubDate>
    <description>&lt;p&gt;Several people were kind enough to point out that this code:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;for i in xrange(foo):&lt;br /&gt;    print i&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;actually wouldn&apos;t work. Thanks, I&apos;m an idiot. I should have had:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;for i in xrange(len(foo)):&lt;br /&gt;    print i&lt;br /&gt;&lt;/pre&gt;&lt;/p&gt;&lt;p&gt;Next, yet another method of reversing/iterating backwards over a list has been suggested in multiple places, one which I didn&apos;t know about.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;foo = [&apos;one&apos;, &apos;two&apos;, &apos;three&apos;]&lt;br /&gt;bar = foo[::-1]&lt;br /&gt;&lt;/pre&gt;&lt;/p&gt;&lt;p&gt;The only thing I can possibly say to that is... but the ternary operator is too obscure? C&apos;mon, give me a break. This provides the ability to have tons of random line noise and make your code just as unreadable.&lt;/p&gt;&lt;p&gt;And, &lt;a href=&quot;http://blog.sethdot.org/index.cgi/223&quot;&gt;Seth&lt;/a&gt;: Since I couldn&apos;t catch you on IRC earlier, I&apos;ll just reply here.&lt;/p&gt;&lt;p&gt;Multiple issues to respond to, so let me break it down.&lt;/p&gt;&lt;p&gt;&lt;ol&gt; &lt;li&gt;You seem to be confused as to what I was complaining about with &lt;code&gt;list.reverse()&lt;/code&gt;. It&apos;s not that I want a copy of the list, exactly, but I want the return value of &lt;code&gt;list.reverse()&lt;/code&gt; to be sane, which in my exceedingly humble opinion, it is nowhere near.&lt;/li&gt; &lt;li&gt;I&apos;m not upset, mind you, just mildly annoyed, by the iteritems()/enumerate()/xrange() issue. And the reason that it&apos;s annoying to me is because it&apos;s inconsistent. Some of the iterator methods are global and some of them are not. Inconsistency is lame. End of topic.&lt;/li&gt; &lt;li&gt;Ternary operators seem to be quite the polarizing issue so I&apos;ll just leave my stance exactly where it is. I think they&apos;re useful, and I&apos;d like to have them, but obviously I can work around the language not having them...&lt;/li&gt; &lt;li&gt;Especially since Python doesn&apos;t have sane scoping, either; the method-local and class-local scoping rules provide the opportunity for &lt;b&gt;way&lt;/b&gt; too many obscure and annoying bugs. I note that you didn&apos;t respond to my issue with scoping at all.&lt;/li&gt; &lt;/ol&gt;&lt;/p&gt;&lt;p&gt;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.&lt;/p&gt;&lt;p&gt;I&apos;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&apos;s a useful language, but I&apos;m just annoyed at the inconsistencies and some pet features (like ternary operators, or sane scoping) that I wish it had.&lt;br /&gt;&lt;/p&gt;</description>
  </item>
  <item>
    <title>python rant</title>
    <link>http://c133.org/blog/tech/python_rant.html</link>
    <pubDate>Fri, 15 Apr 2005 04:25 -1000</pubDate>
    <description>&lt;p&gt;(This is a pretty geeky entry, so if you&apos;re not a geek, consider yourself warned.)&lt;br /&gt;I have a lot of little tiny annoyances with python, since I&apos;ve been using it for a while now to hack on some stuff. Here&apos;s a collection of the ones that are floating on top of my brain.&lt;/p&gt;&lt;p&gt;&lt;h4&gt;::sniff::&lt;/h4&gt;&lt;br /&gt;I miss my ternary operator.&lt;/p&gt;&lt;p&gt;In C, and C++, and Perl, and Ruby, and PHP, and pretty much any language that I&apos;ve ever written in (hell, I think even JavaScript supports this, though I could be wrong about that one since I haven&apos;t written any JavaScript code in years), you can use a very terse syntax for &lt;code&gt;if (foo) { return bar; } else { return baz; }&lt;/code&gt; using what is referred to as the ternary operator.&lt;/p&gt;&lt;p&gt;The shortened syntax is more like:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;(foo ? bar : baz)&lt;br /&gt;&lt;/pre&gt;&lt;/p&gt;&lt;p&gt;Yeah, it&apos;s kinda weird. And yeah, if you don&apos;t understand it, it&apos;s not very intuitive. However, it makes for much shorter and clearer code (to those who grok ternary operators). Python doesn&apos;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 &lt;code&gt;reversed()&lt;/code&gt; instead. Speaking of which...&lt;/p&gt;&lt;p&gt;&lt;h4&gt;backwards&lt;/h4&gt;&lt;br /&gt;Reversing an array is done like:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;foo = [&apos;one&apos;, &apos;two&apos;, &apos;three&apos;]&lt;br /&gt;foo.reverse()&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;This does not return a reversed copy of the array, but it does reverse the array in-place and return &apos;None&apos; which is quite confusing. Especially if you&apos;re used to sensible languages which return a reversed copy. So this code doesn&apos;t work.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;foo = [&apos;one&apos;, &apos;two&apos;, &apos;three&apos;]&lt;br /&gt;for i in foo.reverse(): &lt;span color=&quot;#29416C&quot;&gt;# bzzzt, reverse() returns &apos;None&apos;&lt;/span&gt;&lt;br /&gt;	print i&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;You &lt;b&gt;can&lt;/b&gt; iterate through an array with the &lt;code&gt;reversed()&lt;/code&gt; keyword, like:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;for i in reversed(foo):&lt;br /&gt;	print i&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;b&gt;However&lt;/b&gt;, this is a python-2.4-specific feature, so it&apos;s useless if you care about older python releases. Also, it doesn&apos;t create a reversed array, just hands you a pointer to a reversed list iterator. So you can&apos;t do:&lt;/p&gt;&lt;p&gt;&lt;pre&gt;&lt;br /&gt;foo = [&apos;one&apos;, &apos;two&apos;, &apos;three&apos;]&lt;br /&gt;bar = reversed(foo)&lt;br /&gt;print bar[0] &lt;span color=&quot;#29416C&quot;&gt;# &apos;three&apos;? how about a TypeError!&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/p&gt;&lt;p&gt;Because &lt;code&gt;bar&lt;/code&gt; is actually not a list, or array, or what-have-you, but it&apos;s a listreverseiterator object. Whatever the hell that&apos;s supposed to mean. What it translates into is basically &quot;Surprise! We hate you.&quot;&lt;/p&gt;&lt;p&gt;So, you have to do:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;foo = [&apos;one&apos;, &apos;two&apos;, &apos;three&apos;]&lt;br /&gt;foo.reverse()&lt;br /&gt;for i in foo:&lt;br /&gt;	print i&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Which, granted, ok, isn&apos;t the end of the world, but it&apos;s pretty ugly and it doesn&apos;t work at &lt;b&gt;all&lt;/b&gt; the way I had expected it to, which to me is the sign of a language that sucks.&lt;/p&gt;&lt;p&gt;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&apos;t.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;foo = [&apos;a&apos;, &apos;b&apos;, &apos;c&apos;]&lt;br /&gt;p foo.reverse() &lt;span color=&quot;#29416c&quot;&gt;# prints out &quot;[&apos;c&apos;, &apos;b&apos;, &apos;a&apos;]&quot;&lt;/span&gt;&lt;br /&gt;foo.reverse().each { |i|&lt;br /&gt;	print i&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Ruby&apos;s list iterators are weird, sure. But actually, that&apos;s a good way to bring up my next complaint.&lt;/p&gt;&lt;p&gt;&lt;h4&gt;iterators in general&lt;/h4&gt;&lt;br /&gt;Why the hell do you have multiple types of list iterator methods in python? I shouldn&apos;t have to remember a different type of iterator method for every different type of container, nor should I have to remember whether it&apos;s a global iterator method or a per-container one. That&apos;s just annoying, and pointless.&lt;/p&gt;&lt;p&gt;So, you have &lt;code&gt;foo = [&apos;a&apos;, &apos;b&apos;, &apos;c&apos;]&lt;/code&gt;, right.&lt;br /&gt;Now, to recap, you can traverse the list backwards (in 2.4, anyway) with:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;for i in reversed(foo):&lt;br /&gt;	print i&lt;br /&gt;&lt;/pre&gt;&lt;/p&gt;&lt;p&gt;You can get the indexes of the members of the list with:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;for i in xrange(foo):&lt;br /&gt;	print i &lt;span color=&quot;#29416C&quot;&gt;# Prints out the index of each member&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/p&gt;&lt;p&gt;You can also do:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;for i, n in enumerate(foo):&lt;br /&gt;	print i, n &lt;span color=&quot;#29416C&quot;&gt;# Prints the index and the member&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Although I have no idea why you&apos;d want to. (You can always just do xrange(foo) and then &apos;foo[i]&apos; since they give you the same thing. But ternary operators would be too confusing.)&lt;/p&gt;&lt;p&gt;But, if you have a dict instead of a list, all of a sudden...&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;foo = { &apos;a&apos;:1, &apos;b&apos;:2, &apos;c&apos;:3 }&lt;br /&gt;for i, n in foo.iteritems():&lt;br /&gt;	print i, n&lt;br /&gt;&lt;/pre&gt;&lt;/p&gt;&lt;p&gt;Using &lt;code&gt;enumerate()&lt;/code&gt; gives you the index of the &apos;a&apos;, &apos;b&apos;, and &apos;c&apos; keys. Also, note that &lt;code&gt;enumerate()&lt;/code&gt; is a global, like &lt;code&gt;reversed()&lt;/code&gt;, but &lt;code&gt;iteritems()&lt;/code&gt; is a member of the dict class type. This is the kind of inconsistency in a language that kills me.&lt;/p&gt;&lt;p&gt;&lt;h4&gt;white space&lt;/h4&gt;&lt;br /&gt;Surprisingly, I don&apos;t mind the whitespace thing. It just doesn&apos;t bother me that much. (Ok, so that&apos;s not really a complaint. Still, enough other people complain that I figured it was worth noting that it just doesn&apos;t irk me.)&lt;/p&gt;&lt;p&gt;&lt;h4&gt;scoping&lt;/h4&gt;&lt;br /&gt;Scoping is &lt;b&gt;weird&lt;/b&gt; in python. Let me explain.&lt;br /&gt;In regular languages, a variable declared inside of a block of code only lives until the end of that block; this is the &apos;scope&apos; of the variable. So if you have:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;if (condition) {&lt;br /&gt;	string foo = &quot;hahahaha&quot;;&lt;br /&gt;}&lt;br /&gt;print (foo); &lt;span color=&quot;#29416C&quot;&gt;/* Error! &apos;foo&apos; didn&apos;t make it past that last &apos;}&apos; */&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;(Yeah, that&apos;s not a real language, though I suppose it could be valid C or C++ or something. I don&apos;t care, it&apos;s just there to illustrate a point.)&lt;/p&gt;&lt;p&gt;But in python, guess what?&lt;/p&gt;&lt;p&gt;&lt;pre&gt;&lt;br /&gt;if condition:&lt;br /&gt;	foo = &quot;hahahaha&quot;&lt;/p&gt;&lt;p&gt;print foo &lt;span color=&quot;#29416C&quot;&gt;# This actually &lt;b&gt;*works*&lt;/b&gt; - wtf?&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/p&gt;&lt;p&gt;There are other issues that annoy me, but these are just the ones on top of my head. I&apos;ll write another rant if this one pisses off enough python devs.&lt;br /&gt;&lt;/p&gt;</description>
  </item>
  <item>
    <title>toys</title>
    <link>http://c133.org/blog/tech/toys.html</link>
    <pubDate>Fri, 15 Apr 2005 01:16 -1000</pubDate>
    <description>&lt;p&gt;The other day, I was on Dell&apos;s website. They had the 2005FPW for 25% off, and I thought to myself, &quot;Self, that&apos;s a damned good deal.&quot;&lt;/p&gt;&lt;p&gt;However, I didn&apos;t have $561.75 free on any of my accounts, and the deal expired in a few days. Then I saw the &quot;Apply now&quot; link. &quot;Hmm, instant loan. Nah, you already have too much credit.&quot;&lt;/p&gt;&lt;p&gt;Wait, though. If you apply for credit and you get rejected, at least in the US, you&apos;re automatically entitled to a free credit report. What the hell, why not? I can always use a free copy of my credit report.&lt;/p&gt;&lt;p&gt;About three minutes later, the Dell website comes back with the result. &quot;Congratulations! You qualify for a $1500 line of credit.&quot;&lt;/p&gt;&lt;p&gt;Shit.&lt;/p&gt;&lt;p&gt;Needless to say, now I have a sweet 20&quot; widescreen LCD. It&apos;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.&lt;/p&gt;&lt;p&gt;I&apos;d post pics, but I don&apos;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.&lt;/p&gt;&lt;p&gt;Note: All amounts in USD.&lt;br /&gt;&lt;/p&gt;</description>
  </item>
  <item>
    <title>wtf xda</title>
    <link>http://c133.org/blog/tech/fdo/wtf_xda.html</link>
    <pubDate>Tue, 05 Apr 2005 22:59 -1000</pubDate>
    <description>&lt;p&gt;[@ajax] so working on DRI for i128, i turned off XAA&lt;br /&gt;[@ajax] in the spirit of experimentation, i ran xcompmgr -a&lt;br /&gt;[@ajax] it feels _much_ faster now&lt;br /&gt;[@ajax] like, firefox doesn&apos;t tear when scrolling&lt;br /&gt;[@ajax] it&apos;s kinda weird&lt;br /&gt;[@daniels] hmm&lt;br /&gt;[@daniels] maybe we should rename it to XDA :P&lt;br /&gt;[@ajax] totally unaccelerated, but just fast enough to feel useful&lt;br /&gt;[@ajax] the only unpleasant part is switching desktops&lt;br /&gt;&lt;/p&gt;</description>
  </item>
  </channel>
</rss>