Optional Parameter Requirements

D

dhable

If I'm building a function to accept optional parameters, do I need to
allow for the capture of both the positional arguments as well as the
keyword arguments? If it doesn't make sense to allow keyword arguments,
can I just write:

def myfunc(a, b, *tup):
...

and be done with it?

TIA
 
G

Gabriel Genellina

At said:
If I'm building a function to accept optional parameters, do I need to
allow for the capture of both the positional arguments as well as the
keyword arguments? If it doesn't make sense to allow keyword arguments,
can I just write:

def myfunc(a, b, *tup):
...

and be done with it?

Just try and see if it works.
http://docs.python.org/tut/node6.html#SECTION006730000000000000000


--
Gabriel Genellina
Softlab SRL

__________________________________________________
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis!
¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar
 
B

Bruno Desthuilliers

If I'm building a function to accept optional parameters, do I need to
allow for the capture of both the positional arguments as well as the
keyword arguments?
No.

If it doesn't make sense to allow keyword arguments,
can I just write:

def myfunc(a, b, *tup):
...

and be done with it?

Yes.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top