[Python-ideas] Allow isinstance second argument to be a set of types

Stefan Behnel stefan_ml at behnel.de
Tue Jul 5 10:14:25 CEST 2011


Masklinn, 05.07.2011 08:23:
>
> On 2011-07-05, at 06:32 , Stefan Behnel wrote:
>
>> Raymond Hettinger, 05.07.2011 03:55:
>>>
>>> On Jul 4, 2011, at 6:26 PM, Greg Ewing wrote:
>>>
>>>> Chris Rebert wrote:
>>>>
>>>>> Why does it accept nested tuples in the first place for that matter?
>>>>
>>>> Probably so that tuples could be used to emulate a "set
>>>> of types" before we had real sets.
>>>>
>>>> Now that we do have real sets, it doesn't seem necessary
>>>> to continue with this and allow sets of sets, etc. So
>>>> +1 on leaving tuple as a special case for this and
>>>> treating all other iterables as flat.
>>>
>>> -1 on further garbaging this API by introducing yet another signature variant -- even worse, a signature variant with a special case for the tuple type (didn't we learn our lesson with old-style string formatting).
>>>
>>> I have to agree with Benjamin that this proposal would be utterly unnecessary software bloat.
>>
>> FWIW, another -1 from me. The current API is simple: you pass in either a type or a tuple of types.
> Or a tuple of tuples of types. Or a tuple of tuple of tuple of types.

Yes, that's more or less what I wrote in the next sentence, right the first 
one that you discarded. ;)

Stefan




More information about the Python-ideas mailing list