Python parameter difference

2

In Python, what's the difference between Funcao(param='value') and Funcao(value) ? Or even Funcao(u'value') ?

I'm starting with Python and I've seen codes with these three forms. I do not know if they were functions or methods, but I took everything as a function, to record.

    
asked by anonymous 14.07.2017 / 17:51

1 answer

2
Funcao(param = 'value')

is a function that has a default argument , that is, if the argument is not passed in the Funcao , the 'value' value will be assigned to the param parameter.

Funcao(value)

In this call the parameter calls value , it is in place of param , in the background parameters are local variables, the only difference is that they will be initialized in the function call. In this if you do not pass an argument on the call of Funcao the variable value will have a null value ( None / a>).

I do not know Funcao(p'value') , it could be my fault.

    
14.07.2017 / 18:16