Opened 3 years ago

Closed 3 years ago

#20501 closed defect (fixed)

Don't use today() for default arguments

Reported by: jdemeyer Owned by:
Priority: major Milestone: sage-7.2
Component: finance Keywords:
Cc: Merged in:
Authors: Jeroen Demeyer Reviewers: Travis Scrimshaw
Report Upstream: N/A Work issues:
Branch: d81fbbd (Commits) Commit: d81fbbd0635995ed21902e9f483fd7523cf413d5
Dependencies: Stopgaps:

Description (last modified by jdemeyer)

The file src/sage/finance/stock.py contains this line

def history(self,startdate='Jan+1,+1900',enddate=date.today().strftime("%b+%d,+%Y"), histperiod='daily'):

The causes today's date to be hard-coded in the argspec and in the __doc__, which makes little sense. It is better to use None as default argument and then change None to today in the function body.

Note that doctests don't pass neither with or without this branch.

Change History (5)

comment:1 Changed 3 years ago by jdemeyer

  • Authors set to Jeroen Demeyer
  • Description modified (diff)

comment:2 Changed 3 years ago by jdemeyer

  • Branch set to u/jdemeyer/don_t_use_today___for_default_arguments

comment:3 Changed 3 years ago by jdemeyer

  • Commit set to d81fbbd0635995ed21902e9f483fd7523cf413d5
  • Status changed from new to needs_review

New commits:

d81fbbdDon't use today() for default arguments

comment:4 Changed 3 years ago by tscrim

  • Reviewers set to Travis Scrimshaw
  • Status changed from needs_review to positive_review

comment:5 Changed 3 years ago by vbraun

  • Branch changed from u/jdemeyer/don_t_use_today___for_default_arguments to d81fbbd0635995ed21902e9f483fd7523cf413d5
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.