Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Python 2.3 problem

Reply
Thread Tools

Python 2.3 problem

 
 
Nomen Nescio
Guest
Posts: n/a
 
      08-24-2003
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


 
Reply With Quote
 
 
 
 
Florian Schulze
Guest
Posts: n/a
 
      08-24-2003
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

On Sun, 24 Aug 2003 22:00:01 +0200 (CEST), Nomen Nescio <(E-Mail Removed)>
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
>
>
>




--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
 
Reply With Quote
 
 
 
 
Lee Harr
Guest
Posts: n/a
 
      08-24-2003
In article <(E-Mail Removed)>, 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.
>



This is not allowed.

*args and **kwargs must come after the regular arguments.

http://python.org/doc/current/tut/no...00000000000000

 
Reply With Quote
 
Gary Herron
Guest
Posts: n/a
 
      08-25-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



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: [Python-Dev] [python-committers] [RELEASED] Python 3.2 rc 1 R. David Murray Python 0 01-17-2011 02:23 PM
Re: [Python-Dev] [python-committers] [RELEASED] Python 3.2 rc 1 Senthil Kumaran Python 0 01-17-2011 10:31 AM
Re: [Python-Dev] [Python-3000] RELEASED Python 2.6a1 and 3.0a3 Martin v. L÷wis Python 0 03-01-2008 10:51 PM
Re: [Python-Dev] [Python-3000] RELEASED Python 2.6a1 and 3.0a3 Paul Moore Python 0 03-01-2008 10:39 PM
Searching comp.lang.python/python-list@python.org (was: UTF-8) skip@pobox.com Python 0 03-10-2007 02:50 PM



Advertisments