passing parameters in python function

CrazyProgrammer

I have written one method in python as follows :

 def report(self,year,month):
    print year,month
    emptylist=[]

parameter month is optional. Sometimes it's NOT passed from the caller function but sometimes it is passed.How is this different from the following code ? def func(self,*args,**kwargs):print args,kwargs I know this has simple answer but I'm new to python and programming stuff. Please help me out.

Ashoka Lella

If month has a default value, you can try

 def report(self, year, month='default_value'):
    print year, month
    emptylist = []

The value of month gets overwritten if passed

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Passing a list of parameters into a Python function

From Dev

Passing SOME of the parameters to a function in python

From Dev

passing default parameters with varargs in function in python

From Dev

Passing parameters to python -c inside a bash function?

From Dev

Passing list of parameters as one string to python function

From Dev

Passing an optional function (and optional parameters) to another function in Python?

From Dev

Passing parameters to function closure

From Java

Passing parameters to a Bash function

From Dev

Passing tuples to function parameters

From Dev

Passing "*&" parameters to a function

From Dev

Passing parameters to a function in yii

From Dev

Passing parameters to a resolve function

From Dev

Passing parameters to a function in Ajax

From Dev

Passing SQL function parameters

From Dev

Passing dynamic parameters into a function

From Dev

Passing parameters to a resolve function

From Dev

Passing parameters to a Matlab function

From Dev

Passing parameters with space to function

From Dev

Passing parameters to a function in Ajax

From Dev

Passing parameters to a BASH function

From Dev

Passing function references as parameters

From Dev

passing parameters to function

From Java

Passing multiple parameters to pool.map() function in Python

From Dev

Python saying I'm passing in too many parameters to my function?

From Dev

Passing parameters to a function in switch case using dictionary in python

From Dev

Python saying I'm passing in too many parameters to my function?

From Dev

Python-Tkinter,Combobox - Passing 2 parameters using Lambda function

From Dev

passing additional parameters to two function

From Dev

Passing extra parameters into the stat function

Related Related

  1. 1

    Passing a list of parameters into a Python function

  2. 2

    Passing SOME of the parameters to a function in python

  3. 3

    passing default parameters with varargs in function in python

  4. 4

    Passing parameters to python -c inside a bash function?

  5. 5

    Passing list of parameters as one string to python function

  6. 6

    Passing an optional function (and optional parameters) to another function in Python?

  7. 7

    Passing parameters to function closure

  8. 8

    Passing parameters to a Bash function

  9. 9

    Passing tuples to function parameters

  10. 10

    Passing "*&" parameters to a function

  11. 11

    Passing parameters to a function in yii

  12. 12

    Passing parameters to a resolve function

  13. 13

    Passing parameters to a function in Ajax

  14. 14

    Passing SQL function parameters

  15. 15

    Passing dynamic parameters into a function

  16. 16

    Passing parameters to a resolve function

  17. 17

    Passing parameters to a Matlab function

  18. 18

    Passing parameters with space to function

  19. 19

    Passing parameters to a function in Ajax

  20. 20

    Passing parameters to a BASH function

  21. 21

    Passing function references as parameters

  22. 22

    passing parameters to function

  23. 23

    Passing multiple parameters to pool.map() function in Python

  24. 24

    Python saying I'm passing in too many parameters to my function?

  25. 25

    Passing parameters to a function in switch case using dictionary in python

  26. 26

    Python saying I'm passing in too many parameters to my function?

  27. 27

    Python-Tkinter,Combobox - Passing 2 parameters using Lambda function

  28. 28

    passing additional parameters to two function

  29. 29

    Passing extra parameters into the stat function

HotTag

Archive