more pythonic way

Felix Lazaro Carbonell felix at epepm.cupet.cu
Mon Feb 11 14:29:59 EST 2019


 

Hello to everyone:

Could you please tell me wich way of writing this method is more pythonic:

 

..

    def find_monthly_expenses(month=None, year=None):

        month = month or datetime.date.today()

..

 

Or it should better be:

...

        if not month:

            month = datetime.date.today()

..

 

Cheers,

Felix.

 




More information about the Python-list mailing list