Newbie: static typing?

Chris Angelico rosuav at gmail.com
Tue Aug 6 10:06:40 EDT 2013


On Tue, Aug 6, 2013 at 2:57 PM, Antoon Pardon
<antoon.pardon at rece.vub.ac.be> wrote:
> Op 06-08-13 15:27, Burak Arslan schreef:
>> On 08/06/13 13:12, Rui Maciel wrote:
>>> Joshua Landau wrote:
>>>
>>>> What's the actual problem you're facing? Where do you feel that you
>>>> need to verify types?
>>> A standard case would be when there's a function which is designed expecting
>>> that all operands support a specific interface or contain specific
>>> attributes.
>>>
>>> In other words, when passing an unsupported type causes problems.
>>>
>>
>> Hi,
>>
>> First, let's get over the fact that, with dynamic typing, code fails at
>> runtime. Irrespective of language, you just shouldn't ship untested
>> code, so I say that's not an argument against dynamic typing.
>
> Why not? Can ease of development not be a consideration? So if some
> kind of faults are easier to detect at compile time if you have static
> typing than if you have to design a test for them, I don't see why that
> can't be an argument.

Sure, which is why I like working in Pike, which does have static type
declarations (when you want them; they can get out the way when you
don't). But there will always be, regardless of your language,
criteria that static typing cannot adequately handle, so just write
your code to cope with exceptions - much easier. If the exception's
never thrown, the bug can't be all that serious; otherwise, just deal
with it when you find it, whether that be in initial testing or years
later in production. There WILL BE such errors - that's a given. Deal
with them, rather than trying to eliminate them.

ChrisA



More information about the Python-list mailing list