<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.2.3" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: DictMixin</title>
	<link>http://blog.ianbicking.org/2007/08/17/dictmixin/</link>
	<description></description>
	<pubDate>Mon, 01 Dec 2008 20:31:18 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.3</generator>

	<item>
		<title>By: Ian Bicking</title>
		<link>http://blog.ianbicking.org/2007/08/17/dictmixin/#comment-193</link>
		<dc:creator>Ian Bicking</dc:creator>
		<pubDate>Fri, 17 Aug 2007 18:40:42 +0000</pubDate>
		<guid>http://blog.ianbicking.org/2007/08/17/dictmixin/#comment-193</guid>
		<description>I'm not exactly sure what you were doing.  `obj.__dict__` must be a real dictionary, I don't even think a dictionary subclass is okay.  But that's right at the heart of Python's objects, so it's not too surprising -- lots of low-level code pokes right into an instance's dictionary structure directly, I imagine.  I'm *guessing* something along those lines is what happened to you with Storm?  There's also questions like "can this object change behind my back?" -- which you can feel more confident about with a real dictionary.  As an example, WSGI doesn't allow dictionary-like objects for requests, only exactly `dict`.  It's like a contract in that case.

You can do `class Foo(object, DictMixin):` if you want a new-style dict-like class; that works fine.</description>
		<content:encoded><![CDATA[<p>I&#8217;m not exactly sure what you were doing.  <code>obj.__dict__</code> must be a real dictionary, I don&#8217;t even think a dictionary subclass is okay.  But that&#8217;s right at the heart of Python&#8217;s objects, so it&#8217;s not too surprising &#8212; lots of low-level code pokes right into an instance&#8217;s dictionary structure directly, I imagine.  I&#8217;m <em>guessing</em> something along those lines is what happened to you with Storm?  There&#8217;s also questions like &#8220;can this object change behind my back?&#8221; &#8212; which you can feel more confident about with a real dictionary.  As an example, WSGI doesn&#8217;t allow dictionary-like objects for requests, only exactly <code>dict</code>.  It&#8217;s like a contract in that case.</p>

<p>You can do <code>class Foo(object, DictMixin):</code> if you want a new-style dict-like class; that works fine.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jim</title>
		<link>http://blog.ianbicking.org/2007/08/17/dictmixin/#comment-190</link>
		<dc:creator>Jim</dc:creator>
		<pubDate>Fri, 17 Aug 2007 11:45:03 +0000</pubDate>
		<guid>http://blog.ianbicking.org/2007/08/17/dictmixin/#comment-190</guid>
		<description>DictMixin is handy.  But it's an old-style class, and I ran into difficulty when using it to store dictionary contents in a database with Storm because of that.  This led me to the #storm IRC channel, where I was told simply that what I was doing wasn't a proper dictionary and therefore I should use an over-complicated delegation system instead.  Ugh.

I can't see the point of that.  Yes, a class using DictMixin can do some clever stuff behind the scenes that you wouldn't necessarily expect from a normal dictionary.  But that doesn't mean that it isn't actually a dictionary, does it?  It still stores key/value pairs, right?

I think adapting simple interfaces like the Dict interface to complex behaviour is one of the things that makes Python so useful.  I don't see the problem with "magic" like this, in fact I think it's a great thing.  What do you say to people who want to double your class-count for the sake of it?  Telling them to go back to Java sounds too snotty, but their attitude isn't great either.</description>
		<content:encoded><![CDATA[<p>DictMixin is handy.  But it&#8217;s an old-style class, and I ran into difficulty when using it to store dictionary contents in a database with Storm because of that.  This led me to the #storm IRC channel, where I was told simply that what I was doing wasn&#8217;t a proper dictionary and therefore I should use an over-complicated delegation system instead.  Ugh.</p>

<p>I can&#8217;t see the point of that.  Yes, a class using DictMixin can do some clever stuff behind the scenes that you wouldn&#8217;t necessarily expect from a normal dictionary.  But that doesn&#8217;t mean that it isn&#8217;t actually a dictionary, does it?  It still stores key/value pairs, right?</p>

<p>I think adapting simple interfaces like the Dict interface to complex behaviour is one of the things that makes Python so useful.  I don&#8217;t see the problem with &#8220;magic&#8221; like this, in fact I think it&#8217;s a great thing.  What do you say to people who want to double your class-count for the sake of it?  Telling them to go back to Java sounds too snotty, but their attitude isn&#8217;t great either.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael Neumann</title>
		<link>http://blog.ianbicking.org/2007/08/17/dictmixin/#comment-189</link>
		<dc:creator>Michael Neumann</dc:creator>
		<pubDate>Fri, 17 Aug 2007 08:32:38 +0000</pubDate>
		<guid>http://blog.ianbicking.org/2007/08/17/dictmixin/#comment-189</guid>
		<description>I wrote a Ruby version of your FSDict class. It's here: http://blog.ntecs.de/articles/2007/08/17/ian-bickings-fsdict-in-ruby</description>
		<content:encoded><![CDATA[<p>I wrote a Ruby version of your FSDict class. It&#8217;s here: <a href="http://blog.ntecs.de/articles/2007/08/17/ian-bickings-fsdict-in-ruby" rel="nofollow">http://blog.ntecs.de/articles/2007/08/17/ian-bickings-fsdict-in-ruby</a></p>
]]></content:encoded>
	</item>
</channel>
</rss>
