A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2015-April/139358.html below:

[Python-Dev] Type hints -- a mediocre programmer's reaction

[Python-Dev] Type hints -- a mediocre programmer's reactionTerry Reedy tjreedy at udel.edu
Wed Apr 22 08:32:18 CEST 2015
On 4/21/2015 6:41 PM, Chris Barker wrote:

> Well, it'll catch passing in a string instead of a sequence of strings
> -- one of teh common and semi-insidious type errors I see a lot (at
> least with newbies).
>
> Oh wait, maybe it won't -- a string IS a sequence of strings. That's why
> this is an insidioous bug in teh first place:
>
> List[string]
>
> will work, yes -- but now I'm locked down the user to an actual, list,
> yes? So I try:
>
> Iterable[string]
>
> ah yes -- now users can use tuples of strings, or a custom class, or --
> but wait, darn it, a string IS an iterable of strings.. SIGH.

I was just thinking today that for this, typing needs a subtraction 
(difference) operation in addition to an addition (union) operation: 
Difference(Iterable(str), str)

-- 
Terry Jan Reedy

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4