Robert Dailey writes:
> Suppose I have 2 functions like so:
>
> def Function2( **extra ):
># do stuff
>
> def Function1( **extra ):
>Function2( extra )
(Style note: The Python style guide, PEP 8, would have the above code
written as::
def function2(**extra):
# do stuff
On Jun 23, 7:34 pm, "Gabriel Genellina"
wrote:
> En Tue, 23 Jun 2009 20:57:36 -0300, Robert Dailey
> escribió:
>
> > Suppose I have 2 functions like so:
>
> > def Function2( **extra ):
> > # do stuff
>
> > def Function1( **extra ):
> > Function2( extra )
>
> > As you can see, I would like
En Tue, 23 Jun 2009 20:57:36 -0300, Robert Dailey
escribió:
Suppose I have 2 functions like so:
def Function2( **extra ):
# do stuff
def Function1( **extra ):
Function2( extra )
As you can see, I would like to forward the additional keyword
arguments in variable 'extra' to Function2
> Suppose I have 2 functions like so:
>
> def Function2( **extra ):
> # do stuff
>
> def Function1( **extra ):
> Function2( extra )
>
> As you can see, I would like to forward the additional keyword
> arguments in variable 'extra' to Function2 from Function1. How can I
> do this? I'm using Pyth
Thnak you all.
> In the future, explain "didn't work".
> Wrong output? give actual (copy and paste) and expected.
> Error message? give traceback (copy and paste).
I will be careful.
--
http://mail.python.org/mailman/listinfo/python-list
Ravi wrote:
The following code didn't work:
In the future, explain "didn't work".
Wrong output? give actual (copy and paste) and expected.
Error message? give traceback (copy and paste).
--
http://mail.python.org/mailman/listinfo/python-list
On Sun, 2009-02-22 at 12:09 -0800, Ravi wrote:
> I am sorry about the typo mistake, well the code snippets are as:
>
> # Non Working:
>
> class X(object):
> def f(self, **kwds):
> print kwds
> try:
> print kwds['i'] * 2
> except KeyError:
> print "unknown keyword argument"
> s
On Sun, 2009-02-22 at 11:44 -0800, Ravi wrote:
> The following code didn't work:
>
> class X(object):
> def f(self, **kwds):
> print kwds
> try:
> print kwds['i'] * 2
> except KeyError:
> print
I am sorry about the typo mistake, well the code snippets are as:
# Non Working:
class X(object):
def f(self, **kwds):
print kwds
try:
print kwds['i'] * 2
except KeyError:
print "unknown keyword argument"
self.g("string", kwds)
def g(self, s, **kwds):
print s
print
On Sun, 2009-02-22 at 11:44 -0800, Ravi wrote:
> The following code didn't work:
>
> def g(self, s, kwds):
> print s
> print kwds
This expects the function g to be called with the parameters "s" and
"kwds"
> def g(self, s, **kwds):
>
10 matches
Mail list logo