Python vs. C#
code at joecheng.com
Tue Aug 12 08:03:21 CEST 2003
> > I don't think that "static typing" (Python is strongly typed btw.,
> > just to correct your statement)
> It is? Then I'm confused, because around here people keep talking about
> beauty of avoiding types.
Python is "strongly" typed in the sense that every object has a type. It is
not "statically" typed in that references do not have types. Statically
typed languages generally require you to declare variable types (some
languages infer them) and in return you get compile-time warnings when you
try to call methods that do not exist or perform casts that are semantically
I may be wrong but I believe C is an example of a language with static weak
typing... you have to declare variable types and some types of errors can be
caught at compile time, but you can perform unsafe casts and not only will
the compiler not stop you but at runtime you won't get an exception--just a
possibly corrupted value in memory.
Java and C# have static strong typing.
Python has dynamic strong typing. So, if you can keep the types of your
objects straight without the help of the compiler, you get the benefits of a
concise syntax while enjoying type safety at runtime.
Someone correct me if I've gotten it wrong...
More information about the Python-list