Strong types (.NET) versus weak types (Python)

J

j_mckitrick

I recently took a one week course on .NET, and they emphasized over
and over again that the key is types. Everything is strongly typed
and enforced.

Python is the exact opposite. Yet both claim they improve
productivity and efficiency.

I prefer Python, but is .NET likely to change this view of types?

jonathon
 
S

Steven Bethard

j_mckitrick said:
I recently took a one week course on .NET, and they emphasized over
and over again that the key is types. Everything is strongly typed
and enforced.

Python is the exact opposite.

Python is strongly typed by most normal definitions of "strongly typed" (though
see http://www.python.org/moin/StrongVsWeakTyping for arguments about exactly
what strong/weak typing means). I believe what you mean to say is that .NET is
statically typed, in which case it's true that Python is the opposite --
dynamically typed.

It's claimed by some that Python 3000 will have optional static type
declarations, though only time will tell... It's far from trivial in a language
like Python that allows you to do things like change an object's class at
runtime.
I prefer Python, but is .NET likely to change this view of types?

No. Static vs. dynamic typing is a major language decision and is usually hard
to change, at least in any meaningful way. .NET could go to dynamic typing, but
you would lose all the compile-time checking for very little gain -- AFAIK it
doesn't provide any way to do the things that make dynamic typing most useful,
like adding methods to an object, changing the class of an object, etc. at
runtime.

Steve
 
C

Cameron Laird

Python is strongly typed by most normal definitions of "strongly typed" (though
see http://www.python.org/moin/StrongVsWeakTyping for arguments about exactly
what strong/weak typing means). I believe what you mean to say is that .NET is
statically typed, in which case it's true that Python is the opposite --
dynamically typed.

It's claimed by some that Python 3000 will have optional static type
declarations, though only time will tell... It's far from trivial in a language
like Python that allows you to do things like change an object's class at
runtime.


No. Static vs. dynamic typing is a major language decision and is usually hard
to change, at least in any meaningful way. .NET could go to dynamic typing, but
you would lose all the compile-time checking for very little gain -- AFAIK it
doesn't provide any way to do the things that make dynamic typing most useful,
like adding methods to an object, changing the class of an object, etc. at
runtime.
.
.
.
I'm very curious, now, to learn what the course said.
My *guess* is that good .NET style was presented as at-
tentive to type, without regard to the static-dynamic
dimension.

Whatever's going on, one might well make a case that
good .NET programming and good Python programming
*both* improve on typical contemporary practices.
That's a fairly low bar, as some of my colleagues
phrase it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top