<?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"
	>
<channel>
	<title>Comments on: Decorator pattern in Python</title>
	<atom:link href="http://therning.org/magnus/archives/301/feed" rel="self" type="application/rss+xml" />
	<link>http://therning.org/magnus/archives/301?&amp;owa_from=feed&amp;owa_sid=</link>
	<description>Incoherent mumblings</description>
	<pubDate>Fri, 29 Aug 2008 21:27:29 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.1</generator>
		<item>
		<title>By: Magnus</title>
		<link>http://therning.org/magnus/archives/301#comment-64275</link>
		<dc:creator>Magnus</dc:creator>
		<pubDate>Fri, 15 Jun 2007 23:36:20 +0000</pubDate>
		<guid isPermaLink="false">http://therning.org/magnus/archives/301#comment-64275</guid>
		<description>&lt;p&gt;Pied, mate, I'm sorry... I must go check my prescription!&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Pied, mate, I&#8217;m sorry&#8230; I must go check my prescription!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pied</title>
		<link>http://therning.org/magnus/archives/301#comment-64265</link>
		<dc:creator>Pied</dc:creator>
		<pubDate>Fri, 15 Jun 2007 23:09:57 +0000</pubDate>
		<guid isPermaLink="false">http://therning.org/magnus/archives/301#comment-64265</guid>
		<description>&lt;p&gt;definitely, you should correct the typo in the title, that "pyton"...
I've been seeing it all day long on planet.haskell and I wonder why no one pointed that out...&lt;/p&gt;

&lt;p&gt;P!&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>definitely, you should correct the typo in the title, that &#8220;pyton&#8221;&#8230;<br />
I&#8217;ve been seeing it all day long on planet.haskell and I wonder why no one pointed that out&#8230;</p>
<p>P!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Magnus</title>
		<link>http://therning.org/magnus/archives/301#comment-63899</link>
		<dc:creator>Magnus</dc:creator>
		<pubDate>Fri, 15 Jun 2007 08:01:07 +0000</pubDate>
		<guid isPermaLink="false">http://therning.org/magnus/archives/301#comment-63899</guid>
		<description>&lt;p&gt;Sebastián,&lt;/p&gt;

&lt;p&gt;The @ syntax is for &lt;em&gt;Python decorators&lt;/em&gt;. They are used to decorate &lt;em&gt;one function&lt;/em&gt; (or method) with &lt;em&gt;another function&lt;/em&gt; (or method). The &lt;em&gt;decorator pattern&lt;/em&gt; allows &lt;em&gt;one object&lt;/em&gt; to decorate &lt;em&gt;another object&lt;/em&gt;. In my example the difference isn't very clear since the core class only has one method. I can't see any elegant way of implementing the &lt;em&gt;decorator pattern&lt;/em&gt; using &lt;em&gt;Python decorators&lt;/em&gt;. (I'd also like to point out that your comment adds some weight to my mate's suggestion that there's a confusion about the decorator pattern among Python programmers due to Python's @-style function/method decorator.)&lt;/p&gt;

&lt;p&gt;I couldn't use &lt;code&gt;baseclass.method&lt;/code&gt; as you suggest. &lt;code&gt;YahooWriter&lt;/code&gt; has two base classes, which one would I choose? Also, how would I make one base class "jump" over to the other? No, I need to exploit the MRO and that's exactly what &lt;code&gt;super&lt;/code&gt; allows me to do.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;super&lt;/code&gt; is not deprecated in any way. &lt;a href="http://www.python.org/dev/peps/pep-3135/" rel="nofollow"&gt;PEP 3135&lt;/a&gt; will even make my example a bit nicer once it's implemented. :-)&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Sebastián,</p>
<p>The @ syntax is for <em>Python decorators</em>. They are used to decorate <em>one function</em> (or method) with <em>another function</em> (or method). The <em>decorator pattern</em> allows <em>one object</em> to decorate <em>another object</em>. In my example the difference isn&#8217;t very clear since the core class only has one method. I can&#8217;t see any elegant way of implementing the <em>decorator pattern</em> using <em>Python decorators</em>. (I&#8217;d also like to point out that your comment adds some weight to my mate&#8217;s suggestion that there&#8217;s a confusion about the decorator pattern among Python programmers due to Python&#8217;s @-style function/method decorator.)</p>
<p>I couldn&#8217;t use <code>baseclass.method</code> as you suggest. <code>YahooWriter</code> has two base classes, which one would I choose? Also, how would I make one base class &#8220;jump&#8221; over to the other? No, I need to exploit the MRO and that&#8217;s exactly what <code>super</code> allows me to do.</p>
<p><code>super</code> is not deprecated in any way. <a href="http://www.python.org/dev/peps/pep-3135/" rel="nofollow">PEP 3135</a> will even make my example a bit nicer once it&#8217;s implemented. <img src='http://therning.org/magnus/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sebastián Benítez</title>
		<link>http://therning.org/magnus/archives/301#comment-63862</link>
		<dc:creator>Sebastián Benítez</dc:creator>
		<pubDate>Fri, 15 Jun 2007 06:16:27 +0000</pubDate>
		<guid isPermaLink="false">http://therning.org/magnus/archives/301#comment-63862</guid>
		<description>&lt;p&gt;IIRC, the decorator uses the @ syntax before the method to decorate, like the following:&lt;/p&gt;

&lt;p&gt;@decorate
def method: pass&lt;/p&gt;

&lt;p&gt;Also, I think super is not used anymore. Should have been baseclass.method .&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>IIRC, the decorator uses the @ syntax before the method to decorate, like the following:</p>
<p>@decorate<br />
def method: pass</p>
<p>Also, I think super is not used anymore. Should have been baseclass.method .</p>
]]></content:encoded>
	</item>
</channel>
</rss>
