Python 2.3 problem

Discussion in 'Python' started by Nomen Nescio, Aug 24, 2003.

  1. Nomen Nescio

    Nomen Nescio Guest

    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
     
    Nomen Nescio, Aug 24, 2003
    #1
    1. Advertising

  2. 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 <>
    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/
     
    Florian Schulze, Aug 24, 2003
    #2
    1. Advertising

  3. Nomen Nescio

    Lee Harr Guest

    Lee Harr, Aug 24, 2003
    #3
  4. Nomen Nescio

    Gary Herron Guest

    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
     
    Gary Herron, Aug 25, 2003
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    763
  2. Paul Moore
    Replies:
    0
    Views:
    640
    Paul Moore
    Mar 1, 2008
  3. Martin v. Löwis
    Replies:
    0
    Views:
    684
    Martin v. Löwis
    Mar 1, 2008
  4. Senthil Kumaran
    Replies:
    0
    Views:
    594
    Senthil Kumaran
    Jan 17, 2011
  5. R. David Murray
    Replies:
    0
    Views:
    786
    R. David Murray
    Jan 17, 2011
Loading...

Share This Page