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

Discussion in 'Python' started by j_mckitrick, Nov 12, 2004.

  1. j_mckitrick

    j_mckitrick Guest

    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
     
    j_mckitrick, Nov 12, 2004
    #1
    1. Advertisements

  2. 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.

    Steve
     
    Steven Bethard, Nov 12, 2004
    #2
    1. Advertisements

  3. .
    .
    .
    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.
     
    Cameron Laird, Nov 13, 2004
    #3
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.