Is this pylint error message valid or silly?

Rhodri James rhodri at
Fri Jun 19 09:53:57 EDT 2009

On Fri, 19 Jun 2009 14:36:01 +0100, Matthew Wilson <matt at> wrote:

> On Fri 19 Jun 2009 02:55:52 AM EDT, Terry Reedy wrote:
>>>         if c == "today":
>>>                     c =
>> Now I guess that you actually intend c to be passed as a datetime
>> object. You only used the string as a type annotation, not as a real
>> default value. Something like 'record_date = None' is better.
> Thanks for the feedback.  I think I should have used a more obvious
> string in my original example and a more descriptive parameter name.
> So, pretend that instead of
>     c="today"
> I wrote
>     record_date="defaults to today's date".
> I know my way is unorthodox, but I think it is a little bit more obvious
> to the reader than
>     record_date=None
> The None is a signal to use a default value, but that is only apparent
> after reading the code.

It's a very common idiom, however, and in addition

    record_data is None

is a cheap test, while

    record_data == "defaults to today's date"

is an expensive test as well as easy to mistype.

Rhodri James *-* Wildebeest Herder to the Masses

More information about the Python-list mailing list