I have a small validation to do in my view,i have to check whether the data received from the data field (for which'null'=true) of the form is null or not. Presently i did this by
if data_received == None :
"some task"
and i got what i wanted. My question is Is this code optimum or there is some better way to do the same.
That's pretty much as good as it's going to get. You typically want to use is None
instead of == None
just in case the left hand side is an instance of a class which has defined ==
to mean something special when used with None
, but it's not a big deal here.
is None used for == null and is not None used for !=null
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With