<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments for Airtrout</title>
	<atom:link href="http://sam.tregar.com/blog/comments/feed/" rel="self" type="application/rss+xml" />
	<link>http://sam.tregar.com/blog</link>
	<description>This is Sam&#039;s blog.</description>
	<lastBuildDate>Sat, 22 May 2010 09:17:09 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>Comment on Python Makes Me Say God Damn by Y.H.Wong</title>
		<link>http://sam.tregar.com/blog/2010/05/19/python-makes-me-say-god-damn/comment-page-1/#comment-422</link>
		<dc:creator>Y.H.Wong</dc:creator>
		<pubDate>Sat, 22 May 2010 09:17:09 +0000</pubDate>
		<guid isPermaLink="false">http://sam.tregar.com/blog/?p=104#comment-422</guid>
		<description>&lt;a href=&quot;#comment-406&quot; rel=&quot;nofollow&quot;&gt;@Michael Schlenker &lt;/a&gt; 

Yes you are right, I should have reversed the order of my arguments on Unicode in comment #31. Python 2.x and 3.x are trying its best to deal with Unicode, but out of jealousy, I must mention that Python&#039;s documented (too lazy to google for it, but pretty sure it&#039;s buried somewhere in the i18n-SIG mailing list) unlikelihood of requiring ICU as a compile dependency means there&#039;s very little chance Python will come with good collation support by default now and in the future. You just can&#039;t beat Java&#039;s Unicode support. But then again, it&#039;s a moot point because no sane person will reject Python just because it doesn&#039;t come with a module to do collation by default.

From my limited understanding of Tcl, it doesn&#039;t seem to have the historical burdens that Python and Perl have, and due to the fact that everything in Tcl can be treated as a string, its designer probably took extra care to make sure string support is good. With that said, I wouldn&#039;t know under what circumstance one would choose Tcl over anything.

Due to similar historical reasons, both Perl and Python 2.x&#039;s have come up with similar ways to handle Unicode. But, I would still choose Python over Perl for the following reasons(correct me if there are better ways to do them, I never know what&#039;s the best way to do anything in Perl):

1. I could see if a string is a unicode string by checking if isinstance(u&#039;abc&#039;, unicode), and u&#039;abc&#039; doesn&#039;t have to be UTF-8 encoded.
2. I don&#039;t have to require Encode or use byte when I want to encode an Unicode string. I just do u&#039;blah&#039;.encode(&quot;utf8&quot;).

These are small ideosyntactic differences, but nonetheless I prefer.</description>
		<content:encoded><![CDATA[<p><a href="#comment-406" rel="nofollow">@Michael Schlenker </a> </p>
<p>Yes you are right, I should have reversed the order of my arguments on Unicode in comment #31. Python 2.x and 3.x are trying its best to deal with Unicode, but out of jealousy, I must mention that Python&#8217;s documented (too lazy to google for it, but pretty sure it&#8217;s buried somewhere in the i18n-SIG mailing list) unlikelihood of requiring ICU as a compile dependency means there&#8217;s very little chance Python will come with good collation support by default now and in the future. You just can&#8217;t beat Java&#8217;s Unicode support. But then again, it&#8217;s a moot point because no sane person will reject Python just because it doesn&#8217;t come with a module to do collation by default.</p>
<p>From my limited understanding of Tcl, it doesn&#8217;t seem to have the historical burdens that Python and Perl have, and due to the fact that everything in Tcl can be treated as a string, its designer probably took extra care to make sure string support is good. With that said, I wouldn&#8217;t know under what circumstance one would choose Tcl over anything.</p>
<p>Due to similar historical reasons, both Perl and Python 2.x&#8217;s have come up with similar ways to handle Unicode. But, I would still choose Python over Perl for the following reasons(correct me if there are better ways to do them, I never know what&#8217;s the best way to do anything in Perl):</p>
<p>1. I could see if a string is a unicode string by checking if isinstance(u&#8217;abc&#8217;, unicode), and u&#8217;abc&#8217; doesn&#8217;t have to be UTF-8 encoded.<br />
2. I don&#8217;t have to require Encode or use byte when I want to encode an Unicode string. I just do u&#8217;blah&#8217;.encode(&#8220;utf8&#8243;).</p>
<p>These are small ideosyntactic differences, but nonetheless I prefer.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Python Makes Me Say God Damn by Ali</title>
		<link>http://sam.tregar.com/blog/2010/05/19/python-makes-me-say-god-damn/comment-page-1/#comment-410</link>
		<dc:creator>Ali</dc:creator>
		<pubDate>Fri, 21 May 2010 19:41:09 +0000</pubDate>
		<guid isPermaLink="false">http://sam.tregar.com/blog/?p=104#comment-410</guid>
		<description>Sam, you&#039;re right about multiple elements, of course.  My mistake.

I would only note that the Python dictionary allows for heterogeneous types as values.  The burden is always on the programmer to know/test for the right type when using a dictionary.  For example, in a more general case, a dictionary may return an object other than a string or list.  In your specific example, your expectations didn&#039;t meet the library designer&#039;s choice.  I&#039;m not sure that this case by itself is an argument for having non-iterable strings.</description>
		<content:encoded><![CDATA[<p>Sam, you&#8217;re right about multiple elements, of course.  My mistake.</p>
<p>I would only note that the Python dictionary allows for heterogeneous types as values.  The burden is always on the programmer to know/test for the right type when using a dictionary.  For example, in a more general case, a dictionary may return an object other than a string or list.  In your specific example, your expectations didn&#8217;t meet the library designer&#8217;s choice.  I&#8217;m not sure that this case by itself is an argument for having non-iterable strings.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Python Makes Me Say God Damn by Michael Schlenker</title>
		<link>http://sam.tregar.com/blog/2010/05/19/python-makes-me-say-god-damn/comment-page-1/#comment-406</link>
		<dc:creator>Michael Schlenker</dc:creator>
		<pubDate>Fri, 21 May 2010 16:10:12 +0000</pubDate>
		<guid isPermaLink="false">http://sam.tregar.com/blog/?p=104#comment-406</guid>
		<description>&lt;a href=&quot;#comment-347&quot; rel=&quot;nofollow&quot;&gt;@Y.H.Wong &lt;/a&gt; 

Complaining Python cannot have good unicode support because there is no ICU on the system is pretty lame, isn&#039;t it? Tcl&#039;s unicode support isn&#039;t perfect either, but if you compare it with Python or Perls its far nicer AND in a dynamical language. 

(Which has some other benefits like a sane threading model with no GIL too.)</description>
		<content:encoded><![CDATA[<p><a href="#comment-347" rel="nofollow">@Y.H.Wong </a> </p>
<p>Complaining Python cannot have good unicode support because there is no ICU on the system is pretty lame, isn&#8217;t it? Tcl&#8217;s unicode support isn&#8217;t perfect either, but if you compare it with Python or Perls its far nicer AND in a dynamical language. </p>
<p>(Which has some other benefits like a sane threading model with no GIL too.)</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Python Makes Me Say God Damn by Sam Tregar</title>
		<link>http://sam.tregar.com/blog/2010/05/19/python-makes-me-say-god-damn/comment-page-1/#comment-404</link>
		<dc:creator>Sam Tregar</dc:creator>
		<pubDate>Fri, 21 May 2010 14:06:23 +0000</pubDate>
		<guid isPermaLink="false">http://sam.tregar.com/blog/?p=104#comment-404</guid>
		<description>&lt;a href=&quot;#comment-365&quot; rel=&quot;nofollow&quot;&gt;@Y.H.Wong &lt;/a&gt; Trust me, I&#039;ve tried plenty of other languages, and I&#039;ll keep trying more.  I&#039;m not sure how that&#039;s supposed to keep me from stubbing my toe in Python, but I guess it&#039;s possible!</description>
		<content:encoded><![CDATA[<p><a href="#comment-365" rel="nofollow">@Y.H.Wong </a> Trust me, I&#8217;ve tried plenty of other languages, and I&#8217;ll keep trying more.  I&#8217;m not sure how that&#8217;s supposed to keep me from stubbing my toe in Python, but I guess it&#8217;s possible!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Python Makes Me Say God Damn by Sam Tregar</title>
		<link>http://sam.tregar.com/blog/2010/05/19/python-makes-me-say-god-damn/comment-page-1/#comment-403</link>
		<dc:creator>Sam Tregar</dc:creator>
		<pubDate>Fri, 21 May 2010 14:01:04 +0000</pubDate>
		<guid isPermaLink="false">http://sam.tregar.com/blog/?p=104#comment-403</guid>
		<description>&lt;a href=&quot;#comment-383&quot; rel=&quot;nofollow&quot;&gt;@Ali &lt;/a&gt; You &quot;guess it&#039;s possible&quot; that someone could use the same name twice?  It&#039;s not just possible, it&#039;s common!  That&#039;s how select elements with multiple set work!</description>
		<content:encoded><![CDATA[<p><a href="#comment-383" rel="nofollow">@Ali </a> You &#8220;guess it&#8217;s possible&#8221; that someone could use the same name twice?  It&#8217;s not just possible, it&#8217;s common!  That&#8217;s how select elements with multiple set work!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Python Makes Me Say God Damn by Ali</title>
		<link>http://sam.tregar.com/blog/2010/05/19/python-makes-me-say-god-damn/comment-page-1/#comment-383</link>
		<dc:creator>Ali</dc:creator>
		<pubDate>Fri, 21 May 2010 10:25:22 +0000</pubDate>
		<guid isPermaLink="false">http://sam.tregar.com/blog/?p=104#comment-383</guid>
		<description>Sam,  

Specific to the GET dictionary example you cited, I tihnk Y.H.Wong is right: your library is at fault.  Since you&#039;re using GET, you&#039;re extracting values from the query string.  The HTTP spec expects name/value pairs in the query string.  So, I don&#039;t know why you would expect to get a list.  I guess it&#039;s possible someone could send a name twice (/foo?name1=value1&amp;name1=value2), but this is hardly common and I don&#039;t think it corresponds to any HTML form elements, unless they&#039;re repeated (and then the form designer is in error).</description>
		<content:encoded><![CDATA[<p>Sam,  </p>
<p>Specific to the GET dictionary example you cited, I tihnk Y.H.Wong is right: your library is at fault.  Since you&#8217;re using GET, you&#8217;re extracting values from the query string.  The HTTP spec expects name/value pairs in the query string.  So, I don&#8217;t know why you would expect to get a list.  I guess it&#8217;s possible someone could send a name twice (/foo?name1=value1&amp;name1=value2), but this is hardly common and I don&#8217;t think it corresponds to any HTML form elements, unless they&#8217;re repeated (and then the form designer is in error).</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Python Makes Me Say God Damn by Y.H.Wong</title>
		<link>http://sam.tregar.com/blog/2010/05/19/python-makes-me-say-god-damn/comment-page-1/#comment-365</link>
		<dc:creator>Y.H.Wong</dc:creator>
		<pubDate>Fri, 21 May 2010 07:40:19 +0000</pubDate>
		<guid isPermaLink="false">http://sam.tregar.com/blog/?p=104#comment-365</guid>
		<description>&lt;a href=&quot;#comment-358&quot; rel=&quot;nofollow&quot;&gt;@Sam Tregar &lt;/a&gt; 

I apologize for any strongly worded arguments but I stand by them every word. There&#039;s no need to get testy. I&#039;m sure we can argue our point like adults can&#039;t we?

I can see why coming from a Perl background Python can be surprising, but then you have been programming in it for a year now. It shouldn&#039;t be THAT surprising. As to indexing into string, I&#039;m pretty sure you can do that with Javascript and Ruby, tho in Ruby you get back the ASCII ordinal, which is mind-boggling IMHO. In C#, you can index into anything with indexers. If you can&#039;t understand indexible string, your head is bound to explode every time you try a C-ish language besides Java. It&#039;s really quite common to be able to index into strings, and immensely useful in Python with slicing, so you better get used to it.

Also, indexible strings has nothing to with how a language is typed, I&#039;m just saying you might have confused the problem with a function returning different types under different input with the problem of strings being indexible. In your specific example where you are indexing into a string where a dict maybe returning different types of sequences, it&#039;s really just a rare corner case where the library designer chose to return multiple types that are both sequences. It&#039;s generally frown upon to return different type because of the confusion it may cause as illustrated by your problem. A string is a sequence of characters/bytes, and a list is a sequence of things. Conceptually, in an OOP sense, they are really similar and treating them as the same when you are slicing/indexing into them is quite sensible. I suspect the BDFL would answer you similarly. It&#039;s just because of a bad choice made by someone else in a library that you use, and an unfamiliarity with Python&#039;s types, this confusion has arisen.

I&#039;m not suggesting that you switch to another language, but I do suggest that you try other languages with different paradigms, and try doing things their way. It&#039;s really a mind-opening experience.</description>
		<content:encoded><![CDATA[<p><a href="#comment-358" rel="nofollow">@Sam Tregar </a> </p>
<p>I apologize for any strongly worded arguments but I stand by them every word. There&#8217;s no need to get testy. I&#8217;m sure we can argue our point like adults can&#8217;t we?</p>
<p>I can see why coming from a Perl background Python can be surprising, but then you have been programming in it for a year now. It shouldn&#8217;t be THAT surprising. As to indexing into string, I&#8217;m pretty sure you can do that with Javascript and Ruby, tho in Ruby you get back the ASCII ordinal, which is mind-boggling IMHO. In C#, you can index into anything with indexers. If you can&#8217;t understand indexible string, your head is bound to explode every time you try a C-ish language besides Java. It&#8217;s really quite common to be able to index into strings, and immensely useful in Python with slicing, so you better get used to it.</p>
<p>Also, indexible strings has nothing to with how a language is typed, I&#8217;m just saying you might have confused the problem with a function returning different types under different input with the problem of strings being indexible. In your specific example where you are indexing into a string where a dict maybe returning different types of sequences, it&#8217;s really just a rare corner case where the library designer chose to return multiple types that are both sequences. It&#8217;s generally frown upon to return different type because of the confusion it may cause as illustrated by your problem. A string is a sequence of characters/bytes, and a list is a sequence of things. Conceptually, in an OOP sense, they are really similar and treating them as the same when you are slicing/indexing into them is quite sensible. I suspect the BDFL would answer you similarly. It&#8217;s just because of a bad choice made by someone else in a library that you use, and an unfamiliarity with Python&#8217;s types, this confusion has arisen.</p>
<p>I&#8217;m not suggesting that you switch to another language, but I do suggest that you try other languages with different paradigms, and try doing things their way. It&#8217;s really a mind-opening experience.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Python Makes Me Say God Damn by Sam Tregar</title>
		<link>http://sam.tregar.com/blog/2010/05/19/python-makes-me-say-god-damn/comment-page-1/#comment-358</link>
		<dc:creator>Sam Tregar</dc:creator>
		<pubDate>Fri, 21 May 2010 06:14:35 +0000</pubDate>
		<guid isPermaLink="false">http://sam.tregar.com/blog/?p=104#comment-358</guid>
		<description>&lt;a href=&quot;#comment-355&quot; rel=&quot;nofollow&quot;&gt;@Y.H.Wong &lt;/a&gt; My complaint isn&#039;t specific to Python?  That&#039;s crazy talk.  This situation couldn&#039;t happen in Perl, which is also a loosely typed language.  As soon as you tried to index into a string in Perl you&#039;d get an error, not the first character of the string!  It also couldn&#039;t happen in TCL, unless I&#039;m remembering wrong.  As far as I know Python is the only loosely typed scripting language I&#039;ve used that treats strings and lists the same!

Your suggestion that I switch languages to avoid this minor irritation is also crazy.  Are there no problems in Scala, F# or Go?  Of course not, they&#039;d just be different problems!  In particular there&#039;s no way Go is mature enough to support the applications I work on.  I don&#039;t know much about Scala or F#, but somehow I doubt I&#039;ll be able to convince the group I work with to switch!</description>
		<content:encoded><![CDATA[<p><a href="#comment-355" rel="nofollow">@Y.H.Wong </a> My complaint isn&#8217;t specific to Python?  That&#8217;s crazy talk.  This situation couldn&#8217;t happen in Perl, which is also a loosely typed language.  As soon as you tried to index into a string in Perl you&#8217;d get an error, not the first character of the string!  It also couldn&#8217;t happen in TCL, unless I&#8217;m remembering wrong.  As far as I know Python is the only loosely typed scripting language I&#8217;ve used that treats strings and lists the same!</p>
<p>Your suggestion that I switch languages to avoid this minor irritation is also crazy.  Are there no problems in Scala, F# or Go?  Of course not, they&#8217;d just be different problems!  In particular there&#8217;s no way Go is mature enough to support the applications I work on.  I don&#8217;t know much about Scala or F#, but somehow I doubt I&#8217;ll be able to convince the group I work with to switch!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Python Makes Me Say God Damn by Y.H.Wong</title>
		<link>http://sam.tregar.com/blog/2010/05/19/python-makes-me-say-god-damn/comment-page-1/#comment-355</link>
		<dc:creator>Y.H.Wong</dc:creator>
		<pubDate>Fri, 21 May 2010 05:39:52 +0000</pubDate>
		<guid isPermaLink="false">http://sam.tregar.com/blog/?p=104#comment-355</guid>
		<description>&lt;a href=&quot;#comment-348&quot; rel=&quot;nofollow&quot;&gt;@Sam Tregar &lt;/a&gt; 
Again, It&#039;s the problem with the library I would argue. This confusion results from you don&#039;t really know what&#039;s the type inside the dict&#039;s value set. In your example, I can see why you get confused because GET returns a list of values when there are really multiple values in the parameter, and a string when there&#039;s only 1. I would too, but then if you were the library&#039;s designer, when most of the values are singular except when you submit a list of values from some checkboxes, you&#039;d decide to return a simple string for a singular value too. A function that returns multiple types makes the data flow non-deterministic is often a source of confusion, unfortunately that is the nature of dynamically-typed languages. I&#039;m sure you are aware of this. So your complaint isn&#039;t really specific to Python but a whole class of languages. If you want a more predictable type system without the heavy typing in Java, try something like Scala, F# or Google&#039;s Go.</description>
		<content:encoded><![CDATA[<p><a href="#comment-348" rel="nofollow">@Sam Tregar </a><br />
Again, It&#8217;s the problem with the library I would argue. This confusion results from you don&#8217;t really know what&#8217;s the type inside the dict&#8217;s value set. In your example, I can see why you get confused because GET returns a list of values when there are really multiple values in the parameter, and a string when there&#8217;s only 1. I would too, but then if you were the library&#8217;s designer, when most of the values are singular except when you submit a list of values from some checkboxes, you&#8217;d decide to return a simple string for a singular value too. A function that returns multiple types makes the data flow non-deterministic is often a source of confusion, unfortunately that is the nature of dynamically-typed languages. I&#8217;m sure you are aware of this. So your complaint isn&#8217;t really specific to Python but a whole class of languages. If you want a more predictable type system without the heavy typing in Java, try something like Scala, F# or Google&#8217;s Go.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Python Makes Me Say God Damn by Sam Tregar</title>
		<link>http://sam.tregar.com/blog/2010/05/19/python-makes-me-say-god-damn/comment-page-1/#comment-348</link>
		<dc:creator>Sam Tregar</dc:creator>
		<pubDate>Fri, 21 May 2010 04:22:00 +0000</pubDate>
		<guid isPermaLink="false">http://sam.tregar.com/blog/?p=104#comment-348</guid>
		<description>&lt;a href=&quot;#comment-347&quot; rel=&quot;nofollow&quot;&gt;@Y.H.Wong &lt;/a&gt; 
Two things: 1) I spend a ton of time in the REPL trying stuff out.  It&#039;s great!  Yes, I do things the Perl way sometimes.  If you switched to Perl after using Python for 10 years you&#039;d do stuff the Python way sometimes.  It&#039;s unavoidable.  2) I full understand how dict.items() works - that&#039;s not the point.  For example, consider this data structure:

   data = { &#039;foo&#039;: [&#039;1&#039;, &#039;2&#039;, &#039;3&#039;], &#039;bar&#039;: [&#039;400&#039;, &#039;500&#039;, &#039;600&#039;] }

If you write a loop that works through the values you&#039;re obviously going to write code like I did.  And if you turn out to be wrong and the data structure is really:

   data = { &#039;foo&#039;: &#039;1&#039;, &#039;bar&#039;: &#039;400&#039; }

Then you&#039;re going to make the mistake I did, but Python won&#039;t notice.  It&#039;s happy to treat a string just like a list.  Which is a pain.  And that&#039;s all I&#039;m trying to say.

Oh, and please, I&#039;m not using Snow Leopard.  This is Linux, thank you very much.  I suppose we&#039;ll upgrade to a more recent v2 sometime, but we have a lot of custom RPMs that would need to be recompiled, so it&#039;s not as easy for us as it might be for other people.</description>
		<content:encoded><![CDATA[<p><a href="#comment-347" rel="nofollow">@Y.H.Wong </a><br />
Two things: 1) I spend a ton of time in the REPL trying stuff out.  It&#8217;s great!  Yes, I do things the Perl way sometimes.  If you switched to Perl after using Python for 10 years you&#8217;d do stuff the Python way sometimes.  It&#8217;s unavoidable.  2) I full understand how dict.items() works &#8211; that&#8217;s not the point.  For example, consider this data structure:</p>
<p>   data = { &#8216;foo&#8217;: ['1', '2', '3'], &#8216;bar&#8217;: ['400', '500', '600'] }</p>
<p>If you write a loop that works through the values you&#8217;re obviously going to write code like I did.  And if you turn out to be wrong and the data structure is really:</p>
<p>   data = { &#8216;foo&#8217;: &#8216;1&#8242;, &#8216;bar&#8217;: &#8216;400&#8242; }</p>
<p>Then you&#8217;re going to make the mistake I did, but Python won&#8217;t notice.  It&#8217;s happy to treat a string just like a list.  Which is a pain.  And that&#8217;s all I&#8217;m trying to say.</p>
<p>Oh, and please, I&#8217;m not using Snow Leopard.  This is Linux, thank you very much.  I suppose we&#8217;ll upgrade to a more recent v2 sometime, but we have a lot of custom RPMs that would need to be recompiled, so it&#8217;s not as easy for us as it might be for other people.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
