more pythonic way

Terry Reedy tjreedy at udel.edu
Mon Feb 11 15:35:31 EST 2019


On 2/11/2019 2:46 PM, Felix Lazaro Carbonell wrote:

>      def find_monthly_expenses(month=None, year=None):
>          month = month or datetime.date.today().month
> 
> Or it should better be:

>          if not month:
>              month = datetime.date.today().month

As a 20+ year veteran, I would be fine either way.

-- 
Terry Jan Reedy



More information about the Python-list mailing list