A
A
Antigo_ptz2016-11-28 09:41:10
Django
Antigo_ptz, 2016-11-28 09:41:10

What does a line of python code do?

There is a line of code:

perms = getattr(self, '_get_%s_permissions' % from_name)(user)

Can you tell me what "(user)" means at the end of the line?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Konovalov, 2016-11-28
@Antigo_ptz

getattr() will return the instance attribute, which appears to be a method with some suffix - _get_XXX_permissions , and then call it with the user parameter

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question