DEV Community

Discussion on: Bye-bye pylint

Collapse
 
pchinery profile image
Philip

Thank you for sharing your experience! I have to say that I personally don't like python and never really got into the language, but I find it interesting to see how others are working :)

What I don't understand though is, why use a dynamic language to avoid a type system and then add it again with a linter and maybe unit tests? Wouldn't it be better if the compiler did the work for you in the first place? And even if it might sound provocative, it is meant as an honest question. I mostly work with C# and F# and appreciate the support from the compiler to help me, of course at the cost of being constrained in what you can do. From my experience, the completely dynamic approach often is easy to get started, but hard to maintain and reactor in the long run, because you don't know where you have to apply a change in the data model, if something changes.

Collapse
 
dmerejkowsky profile image
Dimitri Merejkowsky

why use a dynamic language to avoid a type system and then add it again with a linter and maybe unit tests?

Good question.

First of, there are many reasons to use Python: personally I like the simplicity and power of function definitions. You can do pretty much anything you like: named parameters, defaults, variadic arguments, and you still don't have to care about overloading.

I also like the fact that in Python, there's little difference between the name of something and the actual thing.

module_name = "foo"
mod = importlib.import(module_name)

func_name = "do_foo"
func = my_class.getattr(func_name)

And then there's the standard library, the ecosystem, the tooling, the community, the way the language evolves, the fact that it's really easy to learn, the test framework (pytest of course, not unittest) ...

So, back to you original question:

why use a dynamic language?

It's not just a dynamic language, it's a language I love

why use a dynamic language to avoid a type system ?

I'm not avoiding it. You can read more about that here

why add it again with a linter and maybe unit tests ?

Because I can! Those tools are easy to set up and provide many cool features.

I mostly work with C# and F# and appreciate the support from the compiler to help me, of course at the cost of being constrained in what you can do.

Whatever floats your boat :)

Personally I've been writing Python for so long it's hard for me to feel as productive in Python than in any other language, and the cost of the constraints is just too high for me.

That being said, lately I've been writing rust for fun and I'm starting to develop on crush on this language too ...

From my experience, the completely dynamic approach often is easy to get started, but hard to maintain and reactor in the long run, because you don't know where you have to apply a change in the data model, if something changes.

That's a long standing debate I don't really want to get into right now. Just let me say that based on my experience, the thing that help the most maintaining and refactoring large code bases in the long run are automated tests.

Collapse
 
pchinery profile image
Philip

Yes, for sure I don't want to enter a religious debate here right now ;-)

As I said, I'm always interested in understand the perspective and experience of other developers.

And I fully support the conclusion in your linked post, that people tend to be bad at spotting mistakesin their code and we therefore should combine multiple techniques to reduce the number of errors.

For me, a more and more important part is support from the language and compiler, the often (probably too often) quoted "making illegal states unrepresentable". This and a type system can reduce the number of simple automated tests and gives more time to focus on testing the actual logic (again, my experience).

But of course, everyone is today what the own experience made him or her and there are good reasons for each view.