Skip to content

Commit 49be4d7

Browse files
committed
added explanation regarding which projects use type hints
1 parent 7643ccc commit 49be4d7

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

text/main/basics/variables/typesAndTypeHints/typesAndTypeHints.tex

+13-1
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,19 @@
249249
The output given in \cref{exec:variables:assignment_wrong:mypy} informs us about the same error we encountered back in \cref{sec:errorsInIde}:
250250
\emph{\inQuotes{Name \inQuotes{intvar} is not defined.}}
251251
With the \pgls{IDE} and \mypy, we now have independent tools that can help us to discover errors in our code.
252-
The more such tools we have \emph{and actively use}, the more likely it is that we can produce error-free programs.%
252+
The more such tools we have \emph{and actively use}, the more likely it is that we can produce error-free programs.
253+
254+
You may ask why we emphasize that \pglspl{typeHint} are important and good for a programming language where they are originally not part of.
255+
Several important tools, like \psycopg, the \postgresql\ \python\ adapter, are fully annotated with \pglspl{typeHint} based on the PEP484~\cite{PEP484} specification.
256+
Others use these annotations at least partially and/or try to ensure that code which is newly contributed to them is annotated, e.g., \matplotlib~\cite{HDFDM2012MVWPCG}, \numpy~\cite{N2025NTNT}, and \pandas~\cite{PD2025PCTTCB}.
257+
The fact that many popular tools use it only \emph{partially} use instead of being completely type-hinted is that they simply are older than PEP484~\cite{PEP484}, which is from \citeyear{PEP484}.
258+
\scikitlearn\ and \scipy, for instance, to the best of our knowledge, do not adopt static typing at the time of this writing, because this would be very complicated with their existing codebases~\cite{CFNYLH2020ST,DPVPCHG2018ATHFS}.
259+
The lesson we should learn from this is that%
260+
%
261+
\bestPractice{bp:typeHintsFromStart}{%
262+
It is important to integrate \pglspl{typeHint} from the very start at each project. %
263+
The idea to first write code and later annotate it with \pglspl{typeHint} is wrong.%
264+
}%
253265
%
254266
\FloatBarrier%
255267
\endhsection%

text/main/introduction/whyPython/whyPython.tex

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
Second, \python\ is intensely used~\cite{CBST2024LOHPPTDDSAMLA} in the fields of \pgls{AI}~\cite{RN2022AIAMA}, \pgls{ML}~\cite{SSBD2014UMLFTTA}, and \pgls{DS}~\cite{G2019DSFSFPWP} as well as optimization, which are among the most important areas of future technology.
2626
Indeed, the aforementioned Octoverse report~\cite{GS2024OALPTTLATNOGDS} states that the use in soft computing is one of the drivers of \python's popularity.
2727

28-
Third, there exists a very large set of powerful libraries supporting both research and application development in these fields, including \numpy~\cite{HMvdWGVCWTBSKPHvKBHFdRWPGMSRWAGO2020APWN,DBvR2024ITN,J2018NPSCADSAWNSAM}, \pandas~\cite{B2012DPWP,L2024PW}, \scikitlearn~\cite{PVGMTGBPWDVPCBPD2011SMLIP,RLM2022MLWPAS}, \scipy~\cite{VGOHRCBPWBvdWBWMMNJKLCPFMVLPCHQHARPvMS2020SFAFSCIP,J2018NPSCADSAWNSAM}, \tensorflow~\cite{ABCCDDDGIIKLMMMSTVWWYZ2016TASFLSML,L2023TDDBTADMLMWT}, \pytorch~\cite{PGMLBCKLGADKYDRTCSFBC2019PAISHPDLL,RLM2022MLWPAS}, \matplotlib~\cite{H2007MA2GE,P2021HOMLPAVWP,J2018NPSCADSAWNSAM}, \simpy~\cite{Z2024DESIEWS}, and \moptipy~\cite{WW2023RSDEWASSAA}\footnote{Yes, I list \moptipy\ here, next to very well-known and widely-used frameworks, because I am its developer.}, just to name a few.
28+
Third, there exists a very large set of powerful libraries supporting both research and application development in these fields, including \numpy~\cite{HMvdWGVCWTBSKPHvKBHFdRWPGMSRWAGO2020APWN,N2025N,DBvR2024ITN,J2018NPSCADSAWNSAM}, \pandas~\cite{PD2025P,B2012DPWP,L2024PW}, \scikitlearn~\cite{PVGMTGBPWDVPCBPD2011SMLIP,RLM2022MLWPAS}, \scipy~\cite{VGOHRCBPWBvdWBWMMNJKLCPFMVLPCHQHARPvMS2020SFAFSCIP,J2018NPSCADSAWNSAM}, \tensorflow~\cite{ABCCDDDGIIKLMMMSTVWWYZ2016TASFLSML,L2023TDDBTADMLMWT}, \pytorch~\cite{PGMLBCKLGADKYDRTCSFBC2019PAISHPDLL,RLM2022MLWPAS}, \matplotlib~\cite{HDFDM2012MVWP,H2007MA2GE,P2021HOMLPAVWP,J2018NPSCADSAWNSAM}, \simpy~\cite{Z2024DESIEWS}, and \moptipy~\cite{WW2023RSDEWASSAA}\footnote{Yes, I list \moptipy\ here, next to very well-known and widely-used frameworks, because I am its developer.}, just to name a few.
2929
This means that for many tasks, you can find suitable and efficient \python\ libraries that support your work.
3030

3131
Fourth and finally, \python\ is very easy to learn~\cite{GPBS2006WCTIPIHSUP,VR1999CPFERPASEFTPOT}.

0 commit comments

Comments
 (0)