Thanks to all who answered.
On Friday 22 September 2006 17:28, Marc 'BlackJack' Rintsch wrote:
> Christoph Haas wrote:
> > TestModule.py
> >
> > globalvar = 0
> >
> > def def1():
> > print globalvar
> >
> > def def2(foo=globalvar):
> > print foo
> > ---
John Hunter wrote:
>>"Christoph" == Christoph Haas <[EMAIL PROTECTED]> writes:
>
>
> Christoph> Hi, list... I wondered if it's possible to use global
> Christoph> (module) variables as default parameters. A simple
> Christoph> working example:
>
> Christoph>
> "Christoph" == Christoph Haas <[EMAIL PROTECTED]> writes:
Christoph> Hi, list... I wondered if it's possible to use global
Christoph> (module) variables as default parameters. A simple
Christoph> working example:
Christoph>
Chris
Christoph Haas wrote:
> Hi, list...
>
> I wondered if it's possible to use global (module) variables as default
> parameters. A simple working example:
>
>
> #!/usr/bin/python
>
> globalvar = 123
>
> def test(f
In <[EMAIL PROTECTED]>, Christoph Haas
wrote:
> TestModule.py
>
> globalvar = 0
>
> def def1():
> print globalvar
>
> def def2(foo=globalvar):
> print foo
>
>
> Running the test.py script prints "123" and "0".
Hi, list...
I wondered if it's possible to use global (module) variables as default
parameters. A simple working example:
#!/usr/bin/python
globalvar = 123
def test(foo=globalvar):
print foo
test()
Ru