Is this pylint error message valid or silly?

Matthew Wilson matt at tplus1.com
Fri Jun 19 09:36:01 EDT 2009


On Fri 19 Jun 2009 02:55:52 AM EDT, Terry Reedy wrote:
>>         if c == "today":
>>                     c = datetime.today()
>
> 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.

Thanks again for the comments.

Matt



More information about the Python-list mailing list