Hey David, My general rule is that default is something that is a necessary part of the method's input data and optional is, well, optional. For example, suppose I have a q-deformation of a statistic on permutations, so why write another method? Instead let's add a parameter q that defaults to 1 because that's what most users want, but it is still a necessary part of the input data. Alternatively, now suppose I have an algorithm which needs an inital value, but irregardless of that initial value, always computes the statistic. Thus the initial value would be data that is not necessary to be given.
For the most part, it doesn't really matter IMO. If anything, it is better to err on the side of giving a default value (admittably, I sometimes just use optional when I don't want to specify the meaning of the default value). Best, Travis On Saturday, June 13, 2015 at 8:49:01 AM UTC-7, David Perkinson wrote: > > When should one use "optional" versus "default" in docstrings? I've > noticed a lot of variation in the files in /src/sage/. Often, "optional" > is used if the argument in question defaults to "None", but I also see > "(default: None)" or "(default: ``None``)". On the other hand, I also see > examples of "optional" being used when the argument defaults to something > other than None, e.g., -1. > > > -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.