In cases where it makes sense to do explicit type checking (with ABCs or 
whatever), I really detest the look of the isinstance() function.

if isinstance(thing, Fruit) and not isinstance(thing, Apple):

Yucky.

What I really want to write is:

if thing is a Fruit and thing is not an Apple:

and after thinking about it on and off for a while I wonder if it might indeed 
be possible to teach the parser to handle that in a way that eliminates almost 
all possible ambiguity with the regular "is", including perhaps 100% of all 
existing standard library code and almost all user code?

Maybe this has been considered at some point in the past? The "is [not] a|an" 
proposal would at least be a strong contender for "hardest thing to search for 
on the internet" lol.

Thanks!

Gavin
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/YKLNQXONLLZ7OXEMUHXF5HD4PCX4SNVT/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to