<?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 on: More Python trivia</title>
	<atom:link href="http://chadaustin.me/2008/07/more-python-trivia/feed/" rel="self" type="application/rss+xml" />
	<link>http://chadaustin.me/2008/07/more-python-trivia/</link>
	<description></description>
	<lastBuildDate>Sun, 22 Jan 2012 21:02:11 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: timothyfitz</title>
		<link>http://chadaustin.me/2008/07/more-python-trivia/comment-page-1/#comment-4481</link>
		<dc:creator>timothyfitz</dc:creator>
		<pubDate>Mon, 14 Jul 2008 10:40:02 +0000</pubDate>
		<guid isPermaLink="false">http://aegisknight.org/new/2008/07/09/more-python-trivia/#comment-4481</guid>
		<description>Is this really surprising? (Or have I been drinking the kool-aid so long that I forget what plain water is?)

Immutable types implement a += b as a = a + b, while mutable types make the operation in-place.

In place:
a = range(5)
a += [6]

New instance:
a = &quot;five&quot;
a += &quot;six&quot;</description>
		<content:encoded><![CDATA[<p>Is this really surprising? (Or have I been drinking the kool-aid so long that I forget what plain water is?)</p>
<p>Immutable types implement a += b as a = a + b, while mutable types make the operation in-place.</p>
<p>In place:<br />
a = range(5)<br />
a += [6]</p>
<p>New instance:<br />
a = &#8220;five&#8221;<br />
a += &#8220;six&#8221;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: thespeedbump</title>
		<link>http://chadaustin.me/2008/07/more-python-trivia/comment-page-1/#comment-4480</link>
		<dc:creator>thespeedbump</dc:creator>
		<pubDate>Sun, 13 Jul 2008 19:22:10 +0000</pubDate>
		<guid isPermaLink="false">http://aegisknight.org/new/2008/07/09/more-python-trivia/#comment-4480</guid>
		<description>Funny corner cases like this make me think that set() should perhaps not overload operators quite so liberally.

The implementations of &lt; and &gt; are also counterintuitive:
assert not set([1]) &gt; set([2])
assert not set([1]) &lt; set([2])</description>
		<content:encoded><![CDATA[<p>Funny corner cases like this make me think that set() should perhaps not overload operators quite so liberally.</p>
<p>The implementations of < and > are also counterintuitive:<br />
assert not set([1]) > set([2])<br />
assert not set([1]) < set([2])</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: enno</title>
		<link>http://chadaustin.me/2008/07/more-python-trivia/comment-page-1/#comment-4479</link>
		<dc:creator>enno</dc:creator>
		<pubDate>Fri, 11 Jul 2008 14:43:45 +0000</pubDate>
		<guid isPermaLink="false">http://aegisknight.org/new/2008/07/09/more-python-trivia/#comment-4479</guid>
		<description>By the way, this is *exactly* why I still like good old C above all the other languages I write in. Every allocation made is one that I intended.</description>
		<content:encoded><![CDATA[<p>By the way, this is *exactly* why I still like good old C above all the other languages I write in. Every allocation made is one that I intended.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: enno</title>
		<link>http://chadaustin.me/2008/07/more-python-trivia/comment-page-1/#comment-4478</link>
		<dc:creator>enno</dc:creator>
		<pubDate>Fri, 11 Jul 2008 14:42:25 +0000</pubDate>
		<guid isPermaLink="false">http://aegisknight.org/new/2008/07/09/more-python-trivia/#comment-4478</guid>
		<description>I immeidately guessed it, though probably would have fallen for it myself:
&lt;pre&gt;
&gt;&gt;&gt; a = set([1])
&gt;&gt;&gt; b = a
&gt;&gt;&gt; a = a &#124; set([2])
&gt;&gt;&gt; b
set([1])
&gt;&gt;&gt; a
set([1, 2])
&gt;&gt;&gt; c = b
&gt;&gt;&gt; c &#124;= set([3])
&gt;&gt;&gt; c
set([1, 3])
&gt;&gt;&gt; b
set([1, 3])
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>I immeidately guessed it, though probably would have fallen for it myself:</p>
<pre>
>>> a = set([1])
>>> b = a
>>> a = a | set([2])
>>> b
set([1])
>>> a
set([1, 2])
>>> c = b
>>> c |= set([3])
>>> c
set([1, 3])
>>> b
set([1, 3])
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: aegisknight</title>
		<link>http://chadaustin.me/2008/07/more-python-trivia/comment-page-1/#comment-4477</link>
		<dc:creator>aegisknight</dc:creator>
		<pubDate>Fri, 11 Jul 2008 07:53:11 +0000</pubDate>
		<guid isPermaLink="false">http://aegisknight.org/new/2008/07/09/more-python-trivia/#comment-4477</guid>
		<description>Ding ding ding.  (This bit me as I had a recursive loading dependencies, detecting cycles with a set.  I assumed &#124;= would expand out to s = s &#124; t, like the += operator with integers*.  Oops.)

(* More trivia: i += 1 is not an atomic operation in CPython, but list.append is!)</description>
		<content:encoded><![CDATA[<p>Ding ding ding.  (This bit me as I had a recursive loading dependencies, detecting cycles with a set.  I assumed |= would expand out to s = s | t, like the += operator with integers*.  Oops.)</p>
<p>(* More trivia: i += 1 is not an atomic operation in CPython, but list.append is!)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sufianrhazi</title>
		<link>http://chadaustin.me/2008/07/more-python-trivia/comment-page-1/#comment-4476</link>
		<dc:creator>sufianrhazi</dc:creator>
		<pubDate>Fri, 11 Jul 2008 02:02:47 +0000</pubDate>
		<guid isPermaLink="false">http://aegisknight.org/new/2008/07/09/more-python-trivia/#comment-4476</guid>
		<description>__ior__
vs
__or__

The former is done in place, fancy that.</description>
		<content:encoded><![CDATA[<p>__ior__<br />
vs<br />
__or__</p>
<p>The former is done in place, fancy that.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: egometry</title>
		<link>http://chadaustin.me/2008/07/more-python-trivia/comment-page-1/#comment-4475</link>
		<dc:creator>egometry</dc:creator>
		<pubDate>Thu, 10 Jul 2008 17:34:00 +0000</pubDate>
		<guid isPermaLink="false">http://aegisknight.org/new/2008/07/09/more-python-trivia/#comment-4475</guid>
		<description>Do they use different internal methods to get their results?</description>
		<content:encoded><![CDATA[<p>Do they use different internal methods to get their results?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: spizzy</title>
		<link>http://chadaustin.me/2008/07/more-python-trivia/comment-page-1/#comment-4474</link>
		<dc:creator>spizzy</dc:creator>
		<pubDate>Thu, 10 Jul 2008 14:05:24 +0000</pubDate>
		<guid isPermaLink="false">http://aegisknight.org/new/2008/07/09/more-python-trivia/#comment-4474</guid>
		<description>As someone who doesn&#039;t know Python all that well, what is the difference? 

I tried on the command line and seemed to to get the same result.</description>
		<content:encoded><![CDATA[<p>As someone who doesn&#8217;t know Python all that well, what is the difference? </p>
<p>I tried on the command line and seemed to to get the same result.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: anonymous</title>
		<link>http://chadaustin.me/2008/07/more-python-trivia/comment-page-1/#comment-4473</link>
		<dc:creator>anonymous</dc:creator>
		<pubDate>Thu, 10 Jul 2008 13:31:40 +0000</pubDate>
		<guid isPermaLink="false">http://aegisknight.org/new/2008/07/09/more-python-trivia/#comment-4473</guid>
		<description>I don&#039;t know.  I cheated and tested it out, but I couldn&#039;t see any difference in the resulting set a.  Is one faster or something?

-Tyler S.</description>
		<content:encoded><![CDATA[<p>I don&#8217;t know.  I cheated and tested it out, but I couldn&#8217;t see any difference in the resulting set a.  Is one faster or something?</p>
<p>-Tyler S.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

