B
B
bbjob2022-02-02 11:30:56
Django
bbjob, 2022-02-02 11:30:56

How to transfer parameters correctly?

How to transfer parameters correctly so that it is convenient and practical? For example in a Django model:

So
61fa4116d1296049644843.png

Or so
61fa412c455ea325496023.png

Or maybe something else?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
S
seven5674, 2022-02-02
@seven5674

pep8 to help,
both methods are not correct, as for me, although the first one does not contradict the standard, but with a large number of parameters it is not readable
with named parameters, this is closer to me

def func_name(
    var1=def_val1,
    var2=def_val2,
    varN=def_var3)

V
Vindicar, 2022-02-02
@Vindicar

As it is more convenient for you, if only the same in one block of code.
The second approach nibbles the string length more, the first approach can be confusing if used inside an if / while / with header or when defining a function.

M
Mikhail Krostelev, 2022-02-02
@twistfire92

Recommendations here

R
Roman Kitaev, 2022-02-02
@deliro

Use black and don't ask questions like that

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question