Current location: Hot Scripts Forums » Programming Languages » Other Languages » method with additional arguments


method with additional arguments

Reply
  #1 (permalink)  
Old 09-08-06, 08:21 AM
UnrealEd's Avatar
UnrealEd UnrealEd is offline
Community Liaison
 
Join Date: May 2005
Location: Antwerp, Belgium
Posts: 3,165
Thanks: 4
Thanked 25 Times in 25 Posts
method with additional arguments

hi,

i'mhaving a small problem atm: i've got a function with additional input:
Code:
def myfunc(self, *args):
   print args
now my problem is this: i would like to pass these viabels into a function with an exact number of arguments. something like this:
Code:
def myfunc(*args):
   print args
   anotherfunc(args) # the arguments must be passed on to "anotherfunc", who requires 2 arguments:

def anotherfunc(a, b):
   print a,b

# to use it:
myfunc(5, 6)
this will output "5,6", but i don't know how to pass those vars on to "anotherfunc"

i need this for an eventListener, where i have funcs who require like 4 arguments and others require no arguments

thanx in advance. i hope i clearly described my problem
UnrealEd
__________________
"Good judgement comes from experience, and experience comes from bad judgement." - Fred Brooks

Reply With Quote
  #2 (permalink)  
Old 09-08-06, 12:09 PM
UnrealEd's Avatar
UnrealEd UnrealEd is offline
Community Liaison
 
Join Date: May 2005
Location: Antwerp, Belgium
Posts: 3,165
Thanks: 4
Thanked 25 Times in 25 Posts
srry for double posting, but i found the solution:
i had to use apply:
Code:
class Test:
    def test1(self, *args):
        print args
        apply(self.test2, args)

    def test2(self, a, b):
        print a
        print b
a = Test()
a.test1(1,2)
thanx anyway for anyone who has been looking
UnrealEd
__________________
"Good judgement comes from experience, and experience comes from bad judgement." - Fred Brooks

Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
URGENT:: how to solve post method error on asp page in Linux & Apache Server? j14nhAo ASP 2 02-24-06 12:33 PM
Method not found: System.IO.Stream RobertEB ASP.NET 0 05-12-05 08:57 AM
what is the best method to find last word in variable ? GS300 PHP 6 09-15-04 09:13 PM
access form variables from method trotta PHP 1 06-01-04 11:59 PM
one main method sniperx Everything Java 6 01-23-04 06:02 AM


All times are GMT -5. The time now is 03:40 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.