Hi,
This must be very basic, but how'd you pass the same *args several
levels deep?
def func2(*args)
print args # ((1, 2, 3),)
# i want this to output (1, 2, 3) as func1!
# there must be some better way than args[0]?
def func1(*args):
print args # (1, 2, 3)
func2(args)
func1(1,2,3)
Thanks!
Guillermo 5 1421
On Mon, May 12, 2008 at 12:19 PM, Guillermo
<gu**************@googlemail.comwrote:
def func1(*args):
print args # (1, 2, 3)
func2(args)
change this line to:
func2(*args)
--
Jerry
On May 12, 9:19 am, Guillermo <guillermo.lis...@googlemail.comwrote:
Hi,
This must be very basic, but how'd you pass the same *args several
levels deep?
def func2(*args)
print args # ((1, 2, 3),)
# i want this to output (1, 2, 3) as func1!
# there must be some better way than args[0]?
def func1(*args):
print args # (1, 2, 3)
func2(args)
func1(1,2,3)
Thanks!
Guillermo
def func1(*args):
print args
func2(*args) # don't forget the '*'
Matt
Guillermo wrote:
This must be very basic, but how'd you pass the same *args several
levels deep?
def func2(*args)
print args # ((1, 2, 3),)
# i want this to output (1, 2, 3) as func1!
# there must be some better way than args[0]?
def func1(*args):
print args # (1, 2, 3)
func2(args)
func1(1,2,3)
func2(*args)
Thats all. See http://docs.python.org/tut/node6.htm...00000000000000
/MiO
Guillermo wrote:
>This must be very basic, but how'd you pass the same *args several levels deep?
def func2(*args) print args # ((1, 2, 3),) # i want this to output (1, 2, 3) as func1! # there must be some better way than args[0]?
def func1(*args): print args # (1, 2, 3) func2(args)
func1(1,2,3)
Me, myself and I wrote:
func2(*args)
Thats all. See http://docs.python.org/tut/node6.htm...00000000000000
That was a bit unclear. You should use func2(*args) when you call the
function.
/MiO
In article <ee**********************************@e53g2000hsa. googlegroups.com>,
Guillermo <gu**************@googlemail.comwrote:
> Hi,
This must be very basic, but how'd you pass the same *args several levels deep?
def func2(*args)
print args # ((1, 2, 3),)
# i want this to output (1, 2, 3) as func1!
# there must be some better way than args[0]?
def func1(*args):
print args # (1, 2, 3)
func2(args)
func2(*args) # <<<<<<======
> func1(1,2,3)
Gary Duzan
Motorola H&NM This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Ville Vainio |
last post by:
I don't know if you have seen this before, but here goes:
http://text.userlinux.com/white_paper.html
There is a jab at Python, though, mentioning that Ruby is more
"refined".
--
Ville...
|
by: Oliver Fromme |
last post by:
Hi,
I'm trying to write a Python function that parses
an expression and builds a function tree from it
(recursively).
During parsing, lambda functions for the the terms
and sub-expressions...
|
by: Nollie |
last post by:
Say you have a struct:
struct MYSTRUCT
{
int x;
int y;
int w;
int h;
};
|
by: paulw |
last post by:
Hi
Please give problems that "HAS TO" to use recursion (recursive calls to
itself.)
Preferrably real world examples, not knights tour.
I'm thinking about eliminating the use of stack...
...
|
by: bennett |
last post by:
How can I do a loop from 1 to 5, where on line 1 I print 1 space
followed by a button, on line 2 I print 2 spaces followed by a button,
on line 3 I print 3 spaces followed by a button, etc.?
I...
|
by: comp.lang.php |
last post by:
function blah($item) {
if (!isset($baseDir)) {
static $baseDir = '';
$baseDir = $item;
print_r("baseDir = $baseDir\n");
}
$dirID = opendir($item);
while (($fyl = readdir($dirID)) !== false)...
|
by: Frederick Gotham |
last post by:
If we have a simple class such as follows:
#include <string>
struct MyStruct {
std::string member;
MyStruct(unsigned const i)
{
|
by: Stef Mientki |
last post by:
hello,
Is there some handy/ nice manner to view the properties of some variable ?
As a newbie, I often want to see want all the properties of a var,
and also some corner values (large arrays)...
|
by: Rahul |
last post by:
Hi Everyone,
I have the following code,
void f(int &)
{
printf("in f...\n");
}
#ifdef __cplusplus
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |