0

I tried

A == None

but for example for lists it will start checking all of the elements rather than check if A exists at all or not.

How do I check this? Is it so obvious that no one asks? I couldn't find the answer anywhere.

martineau
  • 119,623
  • 25
  • 170
  • 301
Perm. Questiin
  • 429
  • 2
  • 9
  • 21
  • 1
    "for lists it will start checking all of the elements" - no it won't. It'll do that for NumPy arrays, which are very different from lists. – user2357112 Apr 26 '17 at 00:02
  • Using an IDE with a linter like Atom will flag these sort of statements, which might save you time in the future. – mark jay Apr 26 '17 at 00:04

1 Answers1

3

Try this for checking if object is None

if obj is None: print 'Object is none'
mateuszlewko
  • 1,110
  • 8
  • 18