Free Republic
Browse · Search
General/Chat
Topics · Post Article

To: antiRepublicrat
Between Java and c#. Python is too fast and loose with the typing for me. Call me anal retentive, but I require strong typing.

Python has strong typing:

>>> a = 2
>>> b = "hello"
>>> c = a + b
Traceback (most recent call last):
  File "", line 1, in ?
TypeError: unsupported operand types for +: 'int' and 'str'

36 posted on 07/06/2009 3:53:11 PM PDT by dan1123 (Liberals sell it as "speech which is hateful" but it's really "speech I hate".)
[ Post Reply | Private Reply | To 26 | View Replies ]


To: dan1123

That’s not strong typing, it’s duck typing. You didn’t have to declare a, b and c since they took on an assumed type of whatever you assigned to them. It then got caught during runtime, not compile time.

When I program I would wonder is a an int? Maybe it want it to be a byte, decimal, floating point, small (2-byte) int, large (8-byte) int, signed or unsigned.

Duck typing is not necessarily inferior, it’s just a style of programming I don’t prefer. But I do think a programmer should become proficient in strongly-typed design before he goes off with something like Python and produces a horrible, unmaintainable mess.


44 posted on 07/07/2009 6:57:26 AM PDT by antiRepublicrat
[ Post Reply | Private Reply | To 36 | View Replies ]

Free Republic
Browse · Search
General/Chat
Topics · Post Article


FreeRepublic, LLC, PO BOX 9771, FRESNO, CA 93794
FreeRepublic.com is powered by software copyright 2000-2008 John Robinson