<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Let's You and Him Fight &#187; python</title>
	<atom:link href="http://www.letsyouandhimfight.com/tag/python/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.letsyouandhimfight.com</link>
	<description></description>
	<lastBuildDate>Sat, 30 Apr 2011 19:36:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Fun with Descriptors in Python</title>
		<link>http://www.letsyouandhimfight.com/2008/10/24/fun-with-descriptors-in-python/</link>
		<comments>http://www.letsyouandhimfight.com/2008/10/24/fun-with-descriptors-in-python/#comments</comments>
		<pubDate>Sat, 25 Oct 2008 03:26:24 +0000</pubDate>
		<dc:creator>jon</dc:creator>
				<category><![CDATA[Write]]></category>
		<category><![CDATA[descriptors]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.letsyouandhimfight.com/?p=13</guid>
		<description><![CDATA[I always like discovering new features in my favorite languages, especially when it scratches an itch I&#8217;ve been having. A week ago, I was wishing I could have a method in Python be both an instance method and a class method, though now I can&#8217;t recall exactly why. But last night, I saw Ian Bicking&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>I always like discovering new features in my favorite languages, especially when it scratches an itch I&#8217;ve been having. A week ago, I was wishing I could have a method in Python be both an instance method and a class method, though now I can&#8217;t recall exactly why. But last night, I saw Ian Bicking&#8217;s article <a href="http://blog.ianbicking.org/2008/10/24/decorators-and-descriptors/">Decorators and Descriptors</a>, and I realized I could do that with descriptors.</p>
<p>Descriptors, for those of you who didn&#8217;t read the link above, are functions that are run when methods (or attributes) are looked up on new-style classes. The default descriptor on functions is what&#8217;s responsible for sticking the self at the front of the argument list. Here&#8217;s one that changes the function based on whether it&#8217;s being called on a class or an instance:</p>
<p><script src="http://gist.github.com/19678.js"></script></p>
<p>Still not sure what this would be useful for, but I thought I&#8217;d paste it here, because it was fun.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.letsyouandhimfight.com/2008/10/24/fun-with-descriptors-in-python/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

