Python 2.3 problem

N

Nomen Nescio

Hi

When I does this like hear failre goes:

def pinhtranh(*args, laoc_te):
phnoi_crek(args, laoc_te)

I do "laoc_te" last praemetr name always.


Qinh
 
F

Florian Schulze

There is way to few information in this mail, but I guess you meant the
following:

def pinhtranh(*args, laoc_te):
phnoi_crek(*args, laoc_te)

Note the *args on the second line.

Regards,
Florian
 
G

Gary Herron

Hi

When I does this like hear failre goes:

def pinhtranh(*args, laoc_te):
phnoi_crek(args, laoc_te)

I do "laoc_te" last praemetr name always.


Qinh

The syntax of Python does not allow this, but perhaps the following
will do what you want. The two lines in pinhtranh will set "laoc_te"
to the last argument, and "args" to a tuple of all except for the last
argument.

def pinhtranh(*allArgs):
args = allArgs[:-1]
laoc_te = allArgs[-1]
...

I hope that's what you wanted.

Gary Herron
 

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,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top