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

Cameron Laird claird at lairds.us
Fri Nov 12 20:08:04 EST 2004


In article <mailman.6311.1100281935.5135.python-list at python.org>,
Steven Bethard  <steven.bethard at gmail.com> wrote:
>j_mckitrick <j_mckitrick <at> bigfoot.com> writes:
>> 
>> 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.
			.
			.
			.
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.



More information about the Python-list mailing list