Type checking in python?
Armin Steinhoff
Armin at Steinhoff_de
Mon Jul 17 04:02:03 EDT 2000
In article <Ptvc5.40687$MT.1455524 at news-west.usenetserver.com>, Matthew says...
>
>It would be nice if I could do something like:
>
> def my_func(int foo, list bar, Quux quux):
> ...
>
>rather than
>
> def my_func(foo, bar, quux):
> if not isinstance(quux, Quux):
That's plain C ...
if not quux.isinstance(Quux):
is more flexible ... so you have just to implement that method in your class
definition
Regards
Armin
> raise RuntimeError("param 'quux' must be of class 'Quux'")
>
>Is there any plans on doing this for Python 3000? Or will something
>like this never be a part of Python?
>
>
More information about the Python-list
mailing list