Python 2.3 problem
Gary Herron
gherron at islandtraining.com
Mon Aug 25 11:08:03 EDT 2003
On Sunday 24 August 2003 01:00 pm, Nomen Nescio wrote:
> 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
More information about the Python-list
mailing list