file objects nowadays have &quot;.closed&quot; and &quot;.mode&quot; attributes, but the point is -- <br>the dispatch mechanism should be able to put constraints on not only on the <br>*type*, but on the *state* as well -- so once we have multi-dispatch, we 
<br>wouldn&#39;t need to &quot;manually&quot; check the state of the arguments. <br><br>we want to be able to express that in the dispatch itself. imagine this:<br><br>def factorial(n):<br>&nbsp;&nbsp;&nbsp; if n &lt; 0:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; raise ValueError
<br>&nbsp;&nbsp;&nbsp; if n &lt; 2:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return 1<br>&nbsp;&nbsp;&nbsp; return n*factorial(n-1)<br><br>where i want to write it as<br><br>@dispatched<br>def factorial(n : (lambda n: 0 &lt;= n &lt; 2)):<br>&nbsp;&nbsp;&nbsp; return n<br><br>@dispatched<br>
def factorial(n : (lambda n: n &gt;= 2)):<br>
&nbsp;&nbsp;&nbsp; return n * factorial(n-1)<br><br>also note that no case is defined for (n &lt; 0), which makes it an exception<br>automatically. this makes it very much like Haskell&#39;s pattern matching.<br>
<br>you can see some more info at <a href="http://en.wikipedia.org/wiki/ERights">http://en.wikipedia.org/wiki/ERights</a> <br>(look for &quot;guard&quot;)<br><br><br>-tomer<br><br><div><span class="gmail_quote">On 1/17/07, 
<b class="gmail_sendername">Bill Janssen</b> &lt;<a href="mailto:janssen@parc.com">janssen@parc.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Of course, the purpose of using ABCs is to allow easy inspection of<br>the capabilities of an object, and for some objects, the state can be<br>an important part.&nbsp;&nbsp;But don&#39;t be misled to confuse ABCs with simply<br>type-based function dispatch.&nbsp;&nbsp;They&#39;re useful for other things as
<br>well.<br><br>I think that stateful value types should probably have, as you say,<br>mechanisms for inspecting that state.&nbsp;&nbsp;For instance, the current<br>&quot;file&quot; type has a &quot;closed&quot; attribute, doesn&#39;t it?
<br><br>Bill<br></blockquote></div><br>