On Fri, Apr 3, 2009 at 7:21 PM, Wichert Akkerman <span dir="ltr">&lt;<a href="mailto:wichert@wiggy.net">wichert@wiggy.net</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im">Previously Chris Rossi wrote:<br>
&gt; I was wondering if the Zope collective had given any consideration to<br>
&gt; allowing constants to be defined in interfaces.  To be clear, these are<br>
&gt; constant values that make up the protocol defined by the interface.  Just to<br>
&gt; have a concrete example, let&#39;s say we&#39;re modeling an http response:<br>
&gt;<br>
&gt; class IHttpResponse(Interface):<br>
&gt;     &quot;&quot;&quot;Models an HTTP 1.1 response.<br>
&gt;     &quot;&quot;&quot;<br>
&gt;     status = Attribute(&quot;HTTP status code for this response.&quot;)<br>
&gt;<br>
&gt; It might be useful to include in our interface spec what some proper values<br>
&gt; for status code might be and make them available to applications as static<br>
&gt; constants on the interface class.  A naive implementer might do something<br>
&gt; like this:<br>
&gt;<br>
&gt; class IHttpResponse(Interface):<br>
&gt;     &quot;&quot;&quot;Models an HTTP 1.1 response.<br>
&gt;     &quot;&quot;&quot;<br>
&gt;     HTTP_OK = &quot;200 Ok&quot;<br>
&gt;     HTTP_NOT_FOUND = &quot;404 Not Found&quot;<br>
&gt;<br>
&gt;     status = Attribute(&quot;HTTP status code for this response.&quot;)<br>
<br>
</div>This looks like a poor man&#39;s enum. I&#39;ld prefer to have a proper enum<br>
like thing.<br>
</blockquote><div> </div></div>I&#39;m sure you can think of a lot of uses of constant values where an enum wouldn&#39;t be appropriate.  I don&#39;t know that I&#39;d even use an enum in this made up example.  Some use cases might be covered by an enum, sure, but that&#39;s not really the point here.<br>
<br>Thanks,<br>Chris<br><br>