Reference

Rustom Mody rustompmody at gmail.com
Tue Mar 4 23:31:52 EST 2014


On Wednesday, March 5, 2014 9:38:58 AM UTC+5:30, Ian wrote:
> On Tue, Mar 4, 2014 at 8:36 PM, Rustom Mody wrote:
> > * ... which summarizes my objection in this thread: Python's 'is' leaks the
> > machine abstraction. 'id' does it legitimately (somewhat),
> > 'is' does it illegitimately

> Well, since "if x == None" is buggy as a test for sentinel values,
> that means the only legitimate non-buggy way to do it is with "if
> id(x) == id(None)", which just seems gross to me.

Ha Ha! -- Fully agreed!
One should not need to leak the machine abstraction for something as basic
as None testing

As I said earlier my current preference which is least disruptive is to have
as builtin

def isNone(x): return x is None

which should obviate most (basic) uses of is



More information about the Python-list mailing list