[Django]-Django reverse function arguments

7👍

(p.id) is just p.id in parentheses, (p.id,) is a single-element tuple.

Parenthesized forms in docs

3👍

The trailing comma is required if a tuple only has one item to differentiate a tuple from stylistic parenthesis.

Similar questions:
Python tuple comma syntax rule
Why does adding a trailing comma after a string make it a tuple

Leave a comment