Is Python type safe?
premshree_python at yahoo.co.in
Wed Mar 17 16:43:03 CET 2004
--- Roy Smith <roy at panix.com> wrote: > In article
> <221d8dbe.0403161043.52406195 at posting.google.com>,
> srijit at yahoo.com wrote:
> > Hello,
> > 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?
> > Regards,
> > Srijit
> You tell me what you mean by "type safe", and I'll
> tell you if those
> languages meet that definition.
> C++ and Java both have the concept of declaring
> variables to hold a
> certain type of data. I don't know anything about
> C#, but I'll assume I
> can lump it into the C++/Java camp.
> Python on the other hand, carries the type
> information along with the
> data, not with the variable (container) that holds
> the data.
> Neither C++ nor Python will let you add the integer
> 3 to the string
So you are suggesting that type-safe means that
variables are necessarily bound to a particular data
type, right? This is the case with "strongly typed"
languages too. So, are you suggesting type-safe =
strong typing. I'm not sure of this.
> "four", but use different mechanisms to prevent it.
> Oddly enough, Java
> (in a perl-like, but admittedly convenient, stab at
> polymorphism) will let you add them. No clue what
> C# does.
> Which is type safe and which isn't? Well, I think
> we're back to my
> first statement, otherwise we quickly get into
> playing three blind men
> and the elephant.
Yahoo! India Insurance Special: Be informed on the best policies, services, tools and more.
Go to: http://in.insurance.yahoo.com/licspecial/index.html
More information about the Python-list