So in Django the two lines of url code below work the same:
urlpatterns = patterns('',
url(r'^login/$', 'django.contrib.auth.views.login'),
(r'^login/$', 'django.contrib.auth.views.login')
)
AFAIK, the only difference is I can define name='login' so I can use it for reversing url. But besides this, is there any other differences?
There is no difference whatsoever. Have a look at the
patternsfunction indjango.conf.urls.__init__.py, if your url is alistortuplethen it is wrapped up by theurlfunction anyway before being appended to the list of available patterns.