Home Artificial Intelligence Python Type Hinting in Data Science Projects: A Must, a Perhaps, or a No-No?

Python Type Hinting in Data Science Projects: A Must, a Perhaps, or a No-No?

0
Python Type Hinting in Data Science Projects: A Must, a Perhaps, or a No-No?

PYTHON PROGRAMMING

Should we use type hints in data-science projects realized in Python?

Towards Data Science
Whether or not you’re a blissful user of type hinting in Python, you do must know these concepts and the way to use them. Photo by Kerin Gedge on Unsplash

Should we use type hints in data-science projects realized in Python?

Need a disclaimer? Here you’re: It depends. In Proof-of-Concept sorts of projects, it’s often unnecessary. In production projects, at the least in 2023, it quite is. But again, that depends.

I’ll attempt to be as concise as possible, and get to the purpose as fast as possible. I don’t wish to spend hours on considering all pros and cons, for the straightforward reason that the data-science market has quite clear expectations of our work. My goal is to present these expectations to you, not to debate them intimately.

Let’s start by stating the plain. Initially, type hints in Python are optional. Optional like in you don’t must use type hints in Python. In that case, there’s just one answer to our primary query: You may but no, you don’t must use type hints in data science projects!

So… that’s it? Are we done here?

Wait a second. We did state the plain, but we didn’t touch upon anything beyond the plain.

Should we use type hints in data-science projects realized in Python? It depends. In Proof-of-Concept sorts of projects, it’s not vital. In production projects, at the least in 2023, it quite is.

An example. Imagine you’re a Python developer working for a personal company. The corporate has its own rules and suggestions for Python development. One in all the principles is: Use type hints. That’s it — no matter what you favor, you will have to make use of them. Had this been a suggestion, you wouldn’t have had to make use of them. Nevertheless, since this can be a rule, you will have to make use of optional type hints.

Okay, good point. But we’re talking about type hints in data science projects basically, not in a specific company. So, optional, right? You don’t must use them?

LEAVE A REPLY

Please enter your comment!
Please enter your name here