<div dir="ltr">In the current proposal there is no way to teach the type checker such dynamic constraints on the value. You could subclass int and you could implement the constraints dynamically in that class, and you could use that class in an argument spec. (And you could introspect methods at run time and extract the annotation types.) But the static type checker would only check that you're passing instances of that class around, it wouldn't understand the range constraint.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jan 19, 2015 at 6:26 AM, Martin Teichmann <span dir="ltr"><<a href="mailto:lkb.teichmann@gmail.com" target="_blank">lkb.teichmann@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi everybody,<br>
<br>
I'm writing something like remote procedure calls, so type hinting would<br>
be very interesting to me - I could send out the function parameter types<br>
to the remote side, which could already check the type of the parameters<br>
before even sending out a request.<br>
<br>
I would however be interested in even more detailed information. Like<br>
the range in which a number should lie - so giving a maximum and a minimum<br>
value for an int. Would it be possible with a PEP 484 system to add information<br>
like that? For example by inheriting from int?<br>
<br>
Greetings<br>
<span class="HOEnZb"><font color="#888888"><br>
Martin Teichmann<br>
_______________________________________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" target="_blank">https://mail.python.org/mailman/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" target="_blank">http://python.org/psf/codeofconduct/</a><br>
</font></span></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature">--Guido van Rossum (<a href="http://python.org/~guido">python.org/~guido</a>)</div>
</div>