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

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to