The pattern is matches against URLs as a regular-expression, and the brackets in the pattern constitute a 'capturing group', which means the part of the URL that matches that part of the pattern are, well, 'captured'. As it stands, the capture group is anonymous, and the argument passed to the handler is done so positionally (you don't have to call it post_id
). Changing the pattern to (?P<post_id>\d+)
makes it a 'named' group, and the argument to the handler will be a keyword-arg (the name of the argument is significant).
For completeness, if you want a group in your regular expression to be not-capturing (and so not passed as an argument), then indicate it like (?:\d+)