<?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: Python dictionaries are not the same as instances</title>
	<atom:link href="http://www.blueskyonmars.com/2007/06/12/python-dictionaries-are-not-the-same-as-instances/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.blueskyonmars.com/2007/06/12/python-dictionaries-are-not-the-same-as-instances/</link>
	<description>The Nuts and Bolts of Creating Great Software Products</description>
	<lastBuildDate>Sat, 23 Jan 2010 20:09:20 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Ed Singleton</title>
		<link>http://www.blueskyonmars.com/2007/06/12/python-dictionaries-are-not-the-same-as-instances/comment-page-1/#comment-162204</link>
		<dc:creator>Ed Singleton</dc:creator>
		<pubDate>Tue, 26 Jun 2007 10:57:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.blueskyonmars.com/2007/06/12/python-dictionaries-are-not-the-same-as-instances/#comment-162204</guid>
		<description>@tazzzzz,

Debugging and Testing is real life use!  Testing in particular.

Most of my python is in using TurboGears, and I seem to spend a lot of time passing dictionaries around.  I do really like your idea, but I would probably end up reimplementing a lot of the functionality of dictionaries on an instance.</description>
		<content:encoded><![CDATA[<p>@tazzzzz,</p>
<p>Debugging and Testing is real life use!  Testing in particular.</p>
<p>Most of my python is in using TurboGears, and I seem to spend a lot of time passing dictionaries around.  I do really like your idea, but I would probably end up reimplementing a lot of the functionality of dictionaries on an instance.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tazzzzz</title>
		<link>http://www.blueskyonmars.com/2007/06/12/python-dictionaries-are-not-the-same-as-instances/comment-page-1/#comment-162193</link>
		<dc:creator>tazzzzz</dc:creator>
		<pubDate>Tue, 26 Jun 2007 10:37:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.blueskyonmars.com/2007/06/12/python-dictionaries-are-not-the-same-as-instances/#comment-162193</guid>
		<description>@Ed: That&#039;s an interesting point. I wonder if the Cookbook has a function to do that with instances... it can certainly be done, but it&#039;s a little complicated.

In real life usage (not debugging/testing), this is not generally a factor, though, right?

@Observer: no worries... happens to everyone at one time or another.</description>
		<content:encoded><![CDATA[<p>@Ed: That&#8217;s an interesting point. I wonder if the Cookbook has a function to do that with instances&#8230; it can certainly be done, but it&#8217;s a little complicated.</p>
<p>In real life usage (not debugging/testing), this is not generally a factor, though, right?</p>
<p>@Observer: no worries&#8230; happens to everyone at one time or another.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Observer</title>
		<link>http://www.blueskyonmars.com/2007/06/12/python-dictionaries-are-not-the-same-as-instances/comment-page-1/#comment-162179</link>
		<dc:creator>Observer</dc:creator>
		<pubDate>Tue, 26 Jun 2007 09:51:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.blueskyonmars.com/2007/06/12/python-dictionaries-are-not-the-same-as-instances/#comment-162179</guid>
		<description>&quot;Actually what I said was this&quot;

Sorry, misread the intro.  Embarrassing.  Feel free to remove my comment.</description>
		<content:encoded><![CDATA[<p>&#8220;Actually what I said was this&#8221;</p>
<p>Sorry, misread the intro.  Embarrassing.  Feel free to remove my comment.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ed Singleton</title>
		<link>http://www.blueskyonmars.com/2007/06/12/python-dictionaries-are-not-the-same-as-instances/comment-page-1/#comment-162086</link>
		<dc:creator>Ed Singleton</dc:creator>
		<pubDate>Tue, 26 Jun 2007 05:33:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.blueskyonmars.com/2007/06/12/python-dictionaries-are-not-the-same-as-instances/#comment-162086</guid>
		<description>One thing I do like about dictionaries is that it is easy to iterate over their keys and I can&#039;t think off the top of my head how you achieve the same thing with an instance.</description>
		<content:encoded><![CDATA[<p>One thing I do like about dictionaries is that it is easy to iterate over their keys and I can&#8217;t think off the top of my head how you achieve the same thing with an instance.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tazzzzz</title>
		<link>http://www.blueskyonmars.com/2007/06/12/python-dictionaries-are-not-the-same-as-instances/comment-page-1/#comment-161837</link>
		<dc:creator>tazzzzz</dc:creator>
		<pubDate>Mon, 25 Jun 2007 15:41:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.blueskyonmars.com/2007/06/12/python-dictionaries-are-not-the-same-as-instances/#comment-161837</guid>
		<description>Actually what I said was this:

&gt;&gt;&gt; foo = {&#039;bar&#039;:&#039;baz&#039;}
&gt;&gt;&gt; isinstance(foo, dict)
True

My point was that while I&#039;m saying that dictionaries are not the same as instances, I do recognize that they are instances of a class themselves.</description>
		<content:encoded><![CDATA[<p>Actually what I said was this:</p>
<p>>>> foo = {&#8216;bar&#8217;:'baz&#8217;}<br />
>>> isinstance(foo, dict)<br />
True</p>
<p>My point was that while I&#8217;m saying that dictionaries are not the same as instances, I do recognize that they are instances of a class themselves.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Observer</title>
		<link>http://www.blueskyonmars.com/2007/06/12/python-dictionaries-are-not-the-same-as-instances/comment-page-1/#comment-161828</link>
		<dc:creator>Observer</dc:creator>
		<pubDate>Mon, 25 Jun 2007 15:19:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.blueskyonmars.com/2007/06/12/python-dictionaries-are-not-the-same-as-instances/#comment-161828</guid>
		<description>&quot;Yes, yes, I know that Python dictionaries are instances of the dict class&quot;

They are?

&gt;&gt;&gt; instance = object()
&gt;&gt;&gt; isinstance(instance, dict)
False</description>
		<content:encoded><![CDATA[<p>&#8220;Yes, yes, I know that Python dictionaries are instances of the dict class&#8221;</p>
<p>They are?</p>
<p>&gt;&gt;&gt; instance = object()<br />
&gt;&gt;&gt; isinstance(instance, dict)<br />
False</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tazzzzz</title>
		<link>http://www.blueskyonmars.com/2007/06/12/python-dictionaries-are-not-the-same-as-instances/comment-page-1/#comment-158291</link>
		<dc:creator>tazzzzz</dc:creator>
		<pubDate>Sat, 16 Jun 2007 15:46:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.blueskyonmars.com/2007/06/12/python-dictionaries-are-not-the-same-as-instances/#comment-158291</guid>
		<description>I&#039;ve made most of the examples more complete... I think I was a little too brief with them.  Try them now, and I think you&#039;ll see that it is backwards compatible and quite convenient to use... 

You only need fset if the property should be read/write. If it&#039;s read only, just using property as a decorator works well.</description>
		<content:encoded><![CDATA[<p>I&#8217;ve made most of the examples more complete&#8230; I think I was a little too brief with them.  Try them now, and I think you&#8217;ll see that it is backwards compatible and quite convenient to use&#8230; </p>
<p>You only need fset if the property should be read/write. If it&#8217;s read only, just using property as a decorator works well.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeff Darcy</title>
		<link>http://www.blueskyonmars.com/2007/06/12/python-dictionaries-are-not-the-same-as-instances/comment-page-1/#comment-158017</link>
		<dc:creator>Jeff Darcy</dc:creator>
		<pubDate>Fri, 15 Jun 2007 18:37:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.blueskyonmars.com/2007/06/12/python-dictionaries-are-not-the-same-as-instances/#comment-158017</guid>
		<description>Well, besides not being backward-compatible, the example as given doesn&#039;t seem to work.  Doesn&#039;t there need to be a nested fset etc.?</description>
		<content:encoded><![CDATA[<p>Well, besides not being backward-compatible, the example as given doesn&#8217;t seem to work.  Doesn&#8217;t there need to be a nested fset etc.?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tazzzzz</title>
		<link>http://www.blueskyonmars.com/2007/06/12/python-dictionaries-are-not-the-same-as-instances/comment-page-1/#comment-157968</link>
		<dc:creator>tazzzzz</dc:creator>
		<pubDate>Fri, 15 Jun 2007 14:17:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.blueskyonmars.com/2007/06/12/python-dictionaries-are-not-the-same-as-instances/#comment-157968</guid>
		<description>not true... that&#039;s what the property() built-in is for.</description>
		<content:encoded><![CDATA[<p>not true&#8230; that&#8217;s what the property() built-in is for.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeff Darcy</title>
		<link>http://www.blueskyonmars.com/2007/06/12/python-dictionaries-are-not-the-same-as-instances/comment-page-1/#comment-157951</link>
		<dc:creator>Jeff Darcy</dc:creator>
		<pubDate>Fri, 15 Jun 2007 12:59:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.blueskyonmars.com/2007/06/12/python-dictionaries-are-not-the-same-as-instances/#comment-157951</guid>
		<description>Excellent advice, but I do have one small nit to pick.  If you want to replace what was previously a stored value with a computed one, as in your point 2, you have to do it by overriding __getattr__.  If you just make a method with the same name, you have to change other code to &lt;b&gt;call&lt;/b&gt; that function so it&#039;s not entirely transparent.</description>
		<content:encoded><![CDATA[<p>Excellent advice, but I do have one small nit to pick.  If you want to replace what was previously a stored value with a computed one, as in your point 2, you have to do it by overriding __getattr__.  If you just make a method with the same name, you have to change other code to <b>call</b> that function so it&#8217;s not entirely transparent.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic Page Served (once) in 2.151 seconds -->
