`yield from` is a case where two keywords are used together to do something new, but they're both keywords independently of each other. If `a` can be variable or a keyword, we'd have to decide when `x is a y` is using `a` as a keyword and when it's using it as a variable. I don't think introducing that possibility is worth the effort.
On Fri, May 1, 2020 at 2:13 PM Soni L. <[email protected]> wrote: > > > On 2020-05-01 2:46 p.m., Steele Farnsworth wrote: > > So this would make `a` a new keyword. I don't think that could be added > into python 4 at the earliest because it would immediately break all code > for which `a` is a variable name. > > > we could have keyphrases instead of keywords, tbh. > > > I can appreciate wanting to make simple operations easy to read, though I > think this relies too much on understanding English and wouldn't be > intuitive for people who aren't English speaking. I am native English > speaking so I wouldn't know for sure, but I think accepting that "or" is > the same as "||" is an easier jump to make than "x is a y" being a > construct for indicating that x belongs to the y class. > > If you need this English-style syntax, I believe `type(x) is y` is > guaranteed to be True if x is exactly of the y type and not one of its > super classes. > > On Fri, May 1, 2020, 1:27 PM gbs--- via Python-ideas < > [email protected]> wrote: > >> 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 -- [email protected] >> To unsubscribe send an email to [email protected] >> https://mail.python.org/mailman3/lists/python-ideas.python.org/ >> Message archived at >> https://mail.python.org/archives/list/[email protected]/message/YKLNQXONLLZ7OXEMUHXF5HD4PCX4SNVT/ >> Code of Conduct: http://python.org/psf/codeofconduct/ >> > > _______________________________________________ > Python-ideas mailing list -- [email protected] > To unsubscribe send an email to > [email protected]https://mail.python.org/mailman3/lists/python-ideas.python.org/ > Message archived at > https://mail.python.org/archives/list/[email protected]/message/PQSJ6PSRS3JZZUV7CRRKRSGJAPVBYP6G/ > Code of Conduct: http://python.org/psf/codeofconduct/ > > > _______________________________________________ > Python-ideas mailing list -- [email protected] > To unsubscribe send an email to [email protected] > https://mail.python.org/mailman3/lists/python-ideas.python.org/ > Message archived at > https://mail.python.org/archives/list/[email protected]/message/JFSNV7FAKLMTZWQDHJWPX3ZSMKVHA6V3/ > Code of Conduct: http://python.org/psf/codeofconduct/ >
_______________________________________________ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/[email protected]/message/ULZUOHUT4XY7ZB2XF6IAD6J7CDOVG4TU/ Code of Conduct: http://python.org/psf/codeofconduct/
