Pragmatics of the standard is() function
alex23
wuwei23 at gmail.com
Mon Nov 28 22:58:17 EST 2011
On Nov 29, 5:22 am, Den <patents... at gmail.com> wrote:
> On Nov 26, 3:01 pm, Steven D'Aprano <steve
> > That is correct. You probably should rarely use `is`. Apart from testing
> > for None, use of `is` should be rare.
>
> With respect, I disagree with advice that the use of a language
> construct should be rare. All constructs should be used
> *appropriately*.
Steven didn't say it _shouldn't_ be used, only that it it should be
_rarely_ used. General consensus would be that that is the most
appropriate use of 'is'.
Value comparisons are _far_ more common in Python than identity
comparisons, the ubiquitous None notwithstanding.
But for your general point, I totally agree. I feel the same way about
the ternary syntax, boolean defaults for conditionals etc
More information about the Python-list
mailing list