<?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>素心如何天上月 &#187; decorator</title> <atom:link href="http://yongsun.me/tag/decorator/feed/" rel="self" type="application/rss+xml" /><link>http://yongsun.me</link> <description>Yong Sun&#039;s Blog</description> <lastBuildDate>Mon, 19 Mar 2012 02:29:22 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.2</generator> <item><title>python decorator and interface</title><link>http://yongsun.me/2008/09/python-decorator-and-interface/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=python-decorator-and-interface</link> <comments>http://yongsun.me/2008/09/python-decorator-and-interface/#comments</comments> <pubDate>Wed, 10 Sep 2008 11:10:04 +0000</pubDate> <dc:creator>yongsun</dc:creator> <category><![CDATA[General]]></category> <category><![CDATA[decorator]]></category> <category><![CDATA[Python]]></category> <guid
isPermaLink="false">http://yongsun.wordpress.com/2008/09/10/python-decorator-and-interface/</guid> <description><![CDATA[from functools import wraps def interface (fn): @wraps def to_be_implemented (*args): raise Exception ("Interface '%s' is not implemented!" % fn.__name__) return to_be_implemented class Foo (object): @interface def test (self): pass class Bar(Foo): def test (self): pass class Qux(Foo): pass Bar().test() &#8230; <a
href="http://yongsun.me/2008/09/python-decorator-and-interface/">Continue reading <span
class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<pre name="code" class="python">
from functools import wraps
def interface (fn):
    @wraps
    def to_be_implemented (*args):
        raise Exception ("Interface '%s' is not implemented!" % fn.__name__)
    return to_be_implemented
class Foo (object):
    @interface
    def test (self): pass
class Bar(Foo):
    def test (self): pass
class Qux(Foo):
    pass
Bar().test()
Qux().test()
</pre>]]></content:encoded> <wfw:commentRss>http://yongsun.me/2008/09/python-decorator-and-interface/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> </channel> </rss>
