Newbie: static typing?

Rui Maciel rui.maciel at gmail.com
Tue Aug 6 05:01:31 EDT 2013


Ben Finney wrote:

> Rui Maciel <rui.maciel at gmail.com> writes:
> 
>> Is there any pythonic way to perform static typing?
> 
> I think no; static typing is inherently un-Pythonic.
> 
> Python provides strong, dynamic typing. Enjoy it!

Bummer. 


>> Does anyone care to enlighten a newbie?
> 
> Is there some specific problem you think needs static typing? Perhaps
> you could start a new thread, giving an example where you are having
> trouble and you think static typing would help.

It would be nice if some functions threw an error if they were passed a type 
they don't support or weren't designed to handle.  That would avoid having 
to deal with some bugs which otherwise would never happen.  

To avoid this sort of error, I've been testing arguments passed to some 
functions based on their type, and raising TypeError when necessariy, but 
surely there must be a better, more pythonic way to handle this issue.


Rui Maciel



More information about the Python-list mailing list