On Friday, February 5, 2016 at 10:20:22 AM UTC-8, Volker Braun wrote: > > Passing the keywords down individually also incurs some overhead, plus we > are talking about fairly small dicts. Its unlikely to be of a performance > concern IMHO > > As Travis noted, Python *always* makes a shallow copy of **kwds when > passing it down; This dictionary copy is unavoidable if you use **. > > Another small difference between arg=optional and **kwds is that the > latter is keyword only, whereas the former can also be a default value for > a positional argument. >
A further small difference is that with "arg=optional", the absence of "arg" needs to be signalled with a sentinel value. So if we use "arg=..." religiously, your dictionary will always have "maximal size". In general, though, I think it's worth emphasizing **kwargs incurs a dict copy anyway. That means that the difference in cost of calling signatures def f(a=optional,**kwargs) versus def f(**kwargs) is not as big as you might initially guess. I suspect that the verbosity of the former might lead people to believe it has a higher price (I thought so). -- 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 https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.