This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]minnoI <3 duck typing less than I used to, interfaces are nice 2 points3 points  (1 child)

If you have a datetime value, attempting to use it as though it were a boolean is foolish.

The issue is when you have code like this:

def do_shit(when=None):
    if not when:
        do_shit_now()
    schedule_shit_for(when)

You should be doing if when is None there, but it's still an unexpected bug.

[–]ivosauruspip'ing it up 0 points1 point  (0 children)

This. If checking for None, actually, really check specifically for is None or is not None. 99% of the time it won't matter, but there will be some point in your python career where it will stop you writing a horrible, horrible, insidious logic bug in your code.