What is the best way to use the permission_classes combination in Django?

Viewed 33

Writing 'permission_classes' for DRF project, help me decide what is the best way to write it:

The DRF documentation describes two ways to write 'permission_classes': in a tuple and in a list.

# first way, in a list
permission_classes = [IsAuthenticated & IsUserWithAccess]

# or in a tuple
permission_classes = (IsAuthenticated, IsUserWithAccess)

On one side, python is faster with tuples, but writing 'permission_classes' through a list allows you to use the logical '&' operator.

Which do you think is the best way to use from a performance point of view?

0 Answers
Related