PEP 3107 and stronger typing (note: probably a newbie question)

Bruno Desthuilliers bruno.42.desthuilliers at wtf.websiteburo.oops.com
Thu Jun 21 03:04:01 EDT 2007


Stephen R Laniel a écrit :
> On Wed, Jun 20, 2007 at 09:41:09PM +0100, Michael Hoffman wrote:
>> If you asked Java programmers why you couldn't turn *off* Java's static 
>> type checking if you wanted to, you'd probably get a similar response.
> 
> Perhaps it would help for me to explain what I'd like.
> 
> Under both Perl and Python, I've found myself
> having/wanting to write things like so:
> 
> def my_func( int_arg, str_arg ):
>     try:
>         int_arg = int( int_arg )
>         str_arg = str( str_arg )
>     except ValueError:
>         sys.stderr.write( "Args are not of the right type\n" )
>         sys.exit(1)
> 

Just a question : what will happen if you get rid of the try/except 
block ?-)




More information about the Python-list mailing list