On Jul 14, 11:31 pm, Chris Rebert wrote:
> On Tue, Jul 14, 2009 at 1:40 PM, Mohan Parthasarathy
> wrote:
> > Hi,
> > I am a newbie. I am reading
> >http://www.network-theory.co.uk/docs/pytut/KeywordArguments.html
> > Defining a function with "N" arguments and calling them in "M" different
> > way
On Wed, Jul 15, 2009 at 11:54 AM, Tim Rowe wrote:
>
> Curiously, I never use the all-named style in Python, whereas it's my
> normal style in Ada. I shall now enter a period of self-refelection to
> try to work out why I am so inconsistent :-)
>
>
>
I use it for functions that only (or mostly) ha
2009/7/15 Jeremiah Dodds :
> As a hopefully semi-informative aside, I've been writing python code for a
> few years now, and I regularly use all four forms of argument passing listed
> above.
Curiously, I never use the all-named style in Python, whereas it's my
normal style in Ada. I shall now en
On Wed, Jul 15, 2009 at 1:42 AM, Mohan Parthasarathy wrote:
> So, all four of them above has its use cases in practice i guess.
>
> thanks
> mohan
>
As a hopefully semi-informative aside, I've been writing python code for a
few years now, and I regularly use all four forms of argument passing lis
Chris,
Thanks for your clarifications
> > I am a newbie. I am reading
> > http://www.network-theory.co.uk/docs/pytut/KeywordArguments.html
> > Defining a function with "N" arguments and calling them in "M" different
> > ways. Why does it have to be this complicated ? I like the idea of
> calling
On Tue, Jul 14, 2009 at 1:40 PM, Mohan Parthasarathy wrote:
> Hi,
> I am a newbie. I am reading
> http://www.network-theory.co.uk/docs/pytut/KeywordArguments.html
> Defining a function with "N" arguments and calling them in "M" different
> ways. Why does it have to be this complicated ? I like the
Roberto Bonvallet wrote:
> SeanDavis12 wrote:
> > I have a dictionary like:
> >
> > {"a":1, "b":2}
> >
> > and I want to call a function:
> >
> > def func1(a=3,b=4):
> >print a,b
> >
> > so that I get a=1,b=2, how can I go about that?
>
> func1(**yourdict)
Thanks, Roberto.
Sean
--
http:
SeanDavis12 wrote:
> I have a dictionary like:
>
> {"a":1, "b":2}
>
> and I want to call a function:
>
> def func1(a=3,b=4):
>print a,b
>
> so that I get a=1,b=2, how can I go about that?
func1(**yourdict)
--
Roberto Bonvallet
--
http://mail.python.org/mailman/listinfo/python-list
That does work yes :) I just noticed that the script had another little error in it, making me believe that the function call was crooking.Cheers TommyOn Oct 19, 2006, at 12:30 PM, Dustin J. Mitchell wrote:Tommy Grav wrote: I have a small program that goes something like thisdef funcA() : passdef
Tommy Grav wrote:
> I have a small program that goes something like this
>
> def funcA() : pass
> def funcB() : pass
> def funcC() : pass
>
> def determine(f):
> t = f()
> return t
>
> What I would like to do is be able to
>
> n = determine(funcA)
> m = determine(funcB)
>
> But I can
Tommy Grav wrote:
> I have a small program that goes something like this
>
> def funcA() : pass
> def funcB() : pass
> def funcC() : pass
>
> def determine(f):
> t = f()
> return t
>
> What I would like to do is be able to
>
> n = determine(funcA)
> m = determine(funcB)
>
> But I can't really
Brian wrote:
> I just have a basic style question here. Suppose you have the program:
>
> def foo1():
> do something
>
> def foo2()
> do something else
>
> Assume that you want to call these functions at execution. Is it more
> proper to call them directly like:
>
> foo1()
> foo2()
>
> o
The difference becomes clear when you import your program into another
program (or the command line python editor). __name__!='__main__' when
you import, so the functions will not be called if they're inside the
block. This is why you see this block so often at the end of scripts;
so that the scr
anthonyberet wrote:
> This is the first time I have tried out functions (is that the main way
> of making subroutines in Python?)
A function is allowed to change it's arguments and to return None, so
yes, you can consider it as a 'subroutine'.
>
> Anyway, my function, mutate, below
>
> #make a
Without a 'global' statement, all variables which are assigned in the body of a
function are local to that function.
Here is an example showing that f() does not create a module-level variable,
but g() does.
>>> def f():
... z = 3
...
>>> def g():
... global z
... z = 3
...
>>> z
Tr
I haven't play with the thread stuff in Python (yet) but in general terms
(from a C mind), one should not expect read/write actions to be sequential
across threads. I would assume the Python threads eventually goes back to
some system calls for thread handling. If that were the case, you should
Steven Bethard wrote:
Fernando Perez wrote:
Steven Bethard wrote:
Fernando Perez wrote:
Steven Bethard wrote:
I get the correct output, but if you run this yourself, you'll see
that
the numbers 1 through 10 aren't printed in sync with the writes (i.e.
every half second); they're all printed at t
Fernando Perez wrote:
Steven Bethard wrote:
Fernando Perez wrote:
Steven Bethard wrote:
I get the correct output, but if you run this yourself, you'll see that
the numbers 1 through 10 aren't printed in sync with the writes (i.e.
every half second); they're all printed at the end. Could someone
Steven Bethard wrote:
> Fernando Perez wrote:
>> Steven Bethard wrote:
>>
>>
>>>I get the correct output, but if you run this yourself, you'll see that
>>>the numbers 1 through 10 aren't printed in sync with the writes (i.e.
>>>every half second); they're all printed at the end. Could someone
>
Fernando Perez wrote:
Steven Bethard wrote:
I get the correct output, but if you run this yourself, you'll see that
the numbers 1 through 10 aren't printed in sync with the writes (i.e.
every half second); they're all printed at the end. Could someone
explain to me why this happens, and how (if p
Steven Bethard wrote:
> I get the correct output, but if you run this yourself, you'll see that
> the numbers 1 through 10 aren't printed in sync with the writes (i.e.
> every half second); they're all printed at the end. Could someone
> explain to me why this happens, and how (if possible) I can
Thomas Rast wrote:
Steven Bethard <[EMAIL PROTECTED]> writes:
I get the correct output, but if you run this yourself, you'll see
that the numbers 1 through 10 aren't printed in sync with the writes
(i.e. every half second); they're all printed at the end. Could
someone explain to me why this happe
Steven Bethard <[EMAIL PROTECTED]> writes:
> I get the correct output, but if you run this yourself, you'll see
> that the numbers 1 through 10 aren't printed in sync with the writes
> (i.e. every half second); they're all printed at the end. Could
> someone explain to me why this happens, and ho
23 matches
Mail list logo