Return to Home Page
      Blog     Consulting     Seminars     Calendar     Books     CD-ROMS     Newsletter     About     FAQ      Search
 

The discussions I read on strong vs. weak typing on c.l.py led me to think of python as being strongly, but dynamically typed, rather than weakly typed.

f  e  x


Actually Python is a dynamically typed language, meaning
that variables don't have a type, values (objects) have
types (or are instantiations of classes). Variables are
bound to these objects.

C is a weakly typed language (it will perform various
forms of implicit casting or "coercion" on some types,
such as chars to ints) while some other languages are
more strongly typed (and require explicit conversion or
casting for any operation that crosses type
boundaries.

I've heard that Python is a bit more like Lisp/Scheme,
Dylan, and Icon in this respect (dynamic, late binding
of variables to value).

I think it's going to be important to stress this
and the fact that Python distinguishes between mutable
and immutable types, passing mutable types by reference
and immutables by value/copy and allowing only immutable
types to be used as dictionary keys. These seem to be
some of the most confusing aspects of Python to people
coming from C, Perl, and Java.

BTW (By The Way), I love your books. I wish I
could afford to attend one of your seminars. (It's the
old problem, when I'm working I don't have the time and
when I'm not I don't have the money).

f  e  x


Here's a link to a recent blog stating that Python is a strongly, dynamically typed language:

http://www.artima.com/weblogs/viewpost.jsp?thread=7590

f  e  x


I think Python is a strongly-typed and dynamically-typed!

f  e  x


I'm with you on this one - Python is weakly typed. Requiring that no invalid function invocations occur isn't as strong as saying that an argument must be a specific named type.

f  e  x


I have to agree with the strongly/dynamically typed argument.

Perl is weakly/dynamically typed. We can just make a standard
scalar (non-list/non-hash).

my $string = "String";

#Then Add the number 5 to string
$string += 5;

print "Output: $string\n";

And Java is strongly/statically typed, as we have to declare the type of
The variable (String) when we declared the variable name.

private String string = new String("String");

#Then Add the number 5 to string
string += 5;

Python is dynamically/strongly typed. We don't have to declare the type
of variable but once it is set, then you cannot say preform multiplication
on a string.

string = "String"

#Now try to add...
string += 5

--Kristofer

f  e  x


Your words: "weakly-typed language, which means it puts the minimum possible requirements on typing" is true, but that's too generic of a statement.
To me, weakly typed means that the system coerces types as needed to perform the requested operation. Python does not do that because if the operation is not defined for that type it will fail unles explicitily converted. If it works is because that operation is defined for that type.
I think this topic deserves more explanation from you.

f  e  x



Add your comment below. Use an empty line between each paragraph. Paragraphs will be automatically formatted, and single carriage returns will be respected. Use <code> to begin a code block, and </code> to end a code block. Your email address will not be visible to spam harvesters or used in any way except to contact you with further questions.

Your Email Address:

Search     Home     WebLog     Consulting     Seminars     Calendar     Books     CD-ROMS     Newsletter     About     Contact     Site Design     Server Maintenance     Powered by Zope
©2007 MindView, Inc.