Since we're talking about class decorators, I have a question about
function and instancemethod objects. &nbsp;The following code works<br><br>class Root(object):<br> &nbsp; &nbsp;def index(self):<br> &nbsp; &nbsp; &nbsp; &nbsp;return &quot;Hello World!&quot;
<br> &nbsp; &nbsp;index.exposed = True<br><br>but this code<br><br>class Root(object):<br> &nbsp; &nbsp;def index(self):<br> &nbsp; &nbsp; &nbsp; &nbsp;return &quot;Hello World!&quot;<br>index.exposed = True<br><br>gives the following exception<br><br>Traceback (most recent call last):
<br> &nbsp; File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;<br>AttributeError: &#39;instancemethod&#39; object has no attribute &#39;exposed&#39;
<br><br>I can tell that instancemethods can&#39;t have attributes added to
them outside of their class definition. &nbsp;Is this part of the Python
language spec, or just an implementation detail of CPython?<br><br>I
bring this up here because it makes writing certain class decorators
much more annoying. &nbsp;For example, if I want to write a class decorator
that will set &quot;exposed=True&quot; for every method of a class, I must resort
to shenanigans.
<br><font color="#888888"><font color="#888888"><br>- Eli</font></font><br><br>