Paul Rubin wrote:
Blaine <cactus_DAC@yahoo.com> writes:
I wrote some stuff and had a future procedure referenced. It worked
great. Wasn't it up to very recently that Python procedures had to be
defined before use, not following?
You can have forward references at compile time, but the target
procedure has to be defined before you can execute it. That is,
def a():
b()
def b():
print('hi')
a()
works fine. Python is interpreted and "def" is an executable statement, actually a type of assignment statement. So by the time you call a(),
the "def b():" has actually run, so you can call b.
Ok, so I was probably doing something like this instead before:
def a():
b()
a()
def b():
print('hi')
Is that what you mean?
That indeed gives an error. I probably was doing something similar
before and didn't realize it. This will be useful.
--
Hits like a Phillips head into my brain
It's gonna be too dark to sleep again
Cutting my teeth on bars and rusty chains
I'm gonna break my rusty cage And run
--- PyGate Linux v1.5.19
* Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)