[Python-Dev] Re: Python-Dev Digest, Vol 9, Issue 17
Guido van Rossum
guido at python.org
Mon Apr 5 19:30:23 EDT 2004
> One thing I was thinking about (aloud on #python) was a validator
> syntax, something resembling:
>
> def is_int(i):
> return isinstance(number, int):
>
> def is_hashable(h):
> try:
> hash(h)
> return True
> except TypeError:
> return False # or raise exception
>
> def func(is_int : number, hashable : key):
> # code...
Please note that you seem to be using the syntax ``type: variable''.
We've settled on using ``variable: type'' instead. (How to express
types is quite a different story...)
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-Dev
mailing list