Is Python type safe?
Erik Max Francis
max at alcyone.com
Tue Mar 16 19:50:04 EST 2004
srijit at yahoo.com wrote:
> I would like to know the definition of type safe and whether Python
> can be considered as a type safe language. Similarly are Java, C# or
> C++ type safe?
It depends what you mean by "type safe." I've heard two broad
definitions commonly used:
- objects have an intrinsic type which dictates how they behave, objects
define how operations on them behave, rather than operations defining
how untyped objects behave
- the type system in the language cannot be thwarted through unsafe
casts and the like
Python and Java meet both definitions; I'm not sure about C# since I
know there are unsafe operations supported within it (unlike Java) but I
don't know if they allow for defeating the type system. C++ probably
meets the first definition, but definitely doesn't meet the second. C
probably doesn't meet either. A weakly-typed language like Perl doesn't
meet the first definition either.
--
__ Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
/ \ San Jose, CA, USA && 37 20 N 121 53 W && &tSftDotIotE
\__/ Here day fights with night.
-- (the last words of Victor Hugo)
More information about the Python-list
mailing list