Django Book 翻译
菜单>:
TOC
返回
原文:
In practice, using named groups makes your URLconfs slightly more explicit and less prone to argument-order bugs and you can reorder the arguments in your views function definitions. Following the preceding example, if we wanted to change the URLs to include the month *before* the year, and we were using non-named groups, wed have to remember to change the order of arguments in the ``month_archive`` view. If we were using named groups, changing the order of the captured parameters in the URL would have no effect on the view.
翻译:
使用命名组可以让你的URLconfs更加清晰,减少参数次序可能搞混的潜在BUG,还可以 让你在函数定义中对参数重新排序。接着上面这个例子,如果我们想修改URL把月份放到 年份的 *前面* ,而不使用命名组的话,我们就不得不去修改视图 ``month_archive`` 的参数次序。如果我们使用命名组的话,修改URL里提取参数的次序对视图没有影响。
备注:
译者: