[Python-ideas] "Sum" Type hinting [was: Type hinting for path-related functions]

Chris Barker - NOAA Federal chris.barker at noaa.gov
Tue May 17 11:24:34 EDT 2016


The difference between a box with one apple in it and a single apple
is critical.

In fact, I think that is the source of the most common type issue in
real Python code:

You can't tell the difference (without type checking) between a
sequence of strings and a string. Because, of course, a string IS a
sequence of strings. In this case, there is no character type, i.e. no
type to represent a single apple. (Kind of an infinite Russian doll of
Apple boxes...)

Type hinting will help address the issue for strings, but it seems a
very useful distinction for all types.

-CHB


More information about the Python-ideas mailing list