What's the best way to minimize the need of run time checks?

Juan Pablo Romero Méndez jpablo.romero at gmail.com
Wed Aug 10 18:44:10 EDT 2016


I've made my motives to start this conversation very clear:

"""
Determine if there is a style of writing code in a dynamic language that
minimizes the occurrence of runtime errors AND avoids two things:

1) using runtime checks all over the place (either ad hoc or using tools
like Valideer)
2) attempting to test for things that a type checker would normally do
 (not that this is completely possible anyway)
"""

And I really appreciate people taking their time to contribute!

As to why I asked that, there are several reasons: I have a very concrete
need right now to find pragmatic ways to increase code quality, reduce
number of defects, etc. in a Python code base. But also I want to
understand better the mind set and culture of Python's community.


You make a good point that my last remark is unrelated to that goal, but
please don't take it as an attack of any sort.

Languages are not monolithically good / bad. They have features that can be
individually evaluated in light of different goals (just to name a few: is
it performant enough?, is it easy to learn?, is it easy to write? is it
easy to make it correct? is it expressive? is it easy to refactor? is it
easy to deploy?, does it have good documentation? etc etc etc. ). Also
languages evolve, so features that were considered positive at some point
can become out of fashion over the years.
I'm honestly interested in finding good examples of cases where the dynamic
features of some language are a better solution than static typing. This is
of course more useful in languages that support both paradigms.

  Juan Pablo


2016-08-10 13:50 GMT-07:00 Michael Selik <michael.selik at gmail.com>:

>
>
> On Wed, Aug 10, 2016, 4:34 PM Juan Pablo Romero Méndez <
> jpablo.romero at gmail.com> wrote:
>
>>
>> I've been trying to find (without success so far) an example of a
>> situation
>> where the dynamic features of a language like Python provides a clear
>> advantage over languages with more than one type.
>>
>
> Only one type? There are a great variety of types for Python objects. Even
> Python classes have types. Further, you can modify types at runtime! It's a
> typing bonanza!
>
> I suppose you could argue we're conflating types and classes. If so, it
> sounds like you started this conversation with an ulterior motive and not
> to learn about best practices for runtime type checking in Python.
>
>>



More information about the Python-list mailing list