On Jul 2, 2011, at 9:37 AM, cjrh wrote: > On Saturday, 2 July 2011 16:57:11 UTC+2, Jonathan Lundell wrote: > On Jul 2, 2011, at 7:41 AM, Anthony wrote: > > On Saturday, July 2, 2011 6:22:15 AM UTC-4, cjrh wrote: > So, extension=None is saying that we're going to stick with the same > extension as the current request, and if it happens to be 'html', we'll > preserve that as well, but leave it implicit. > > extension=False (or anything that evaluates to False) is saying explicitly: > no extension at all. > > > Wouldn't it be a lot better if the default argument was "extension='.html'"? > I don't see why None should mean "use .html", when a default arg of ".html" > could do the job even better. I should think that None and False should be > synonymous in this case, and IMO None is better than False.
Regardless, it's not possible to change it now, since it would break all kinds of code. But None is pretty conventional in Python to indicate a default value, and that's what's used for most of the other arguments to URL. The question is whether the default ought to be explicitly 'html' or the extension of the current request. For a lot of applications that's the same thing--everything is html. Where it's not html, it seems natural that if the request is for something.rss (say) that the default response have an extension of .rss, and that's what URL is doing now (with a provision to override that default if necessary).