[Python-ideas] Allow isinstance second argument to be a set of types
Benjamin Peterson
benjamin at python.org
Thu Jul 7 01:35:34 CEST 2011
Michael Foord <fuzzyman at ...> writes:
>
>
> On 6 July 2011 17:55, Benjamin Peterson <benjamin <at> python.org> wrote:
> Michael Foord <fuzzyman <at> ...> writes:
> > It would feel cleaner to me if I could make FunctionTypes a set and use that
> as the second argument to isinstance.
> I just had a another thought about abritrary collections. It was explode loudly
> if you made an class.
>
>
> Could you rephrase please? I have no idea what this means. All the
best,Michael Foord
Mm. I don't blame you. I'll speak code:
class Evil(type):
def __iter__(self):
return range(42)
class Accomplice(metaclass=Evil):
pass
isinstance(12, Accomplice()) # boom if arbitrary iterables are allowed
More information about the Python-ideas
mailing list