Article View: comp.lang.python
Article #211Re: Python allowing future procedures declared, when was this change?
From: Paul Rubin
Date: Wed, 11 Nov 2026 00:29
Date: Wed, 11 Nov 2026 00:29
19 lines
1786 bytes
1786 bytes
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.
Technical Details
Message-ID:
<87a4ngrz14.fsf@nightsong.com>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mailReferences:
<11d0b12$2jvp1$1@dont-email.me>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail From: Paul Rubin <no.email@nospam.invalid> Newsgroups: comp.lang.python Subject: Re: Python allowing future procedures declared, when was this change? Date: Tue, 10 Nov 2026 16:29:27 -0800 Organization: A noiseless patient Spider Lines: 19 Message-ID: <87a4ngrz14.fsf@nightsong.com> References: <11d0b12$2jvp1$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain Injection-Date: Wed, 11 Nov 2026 00:29:28 +0000 (UTC) Injection-Info: dont-email.me; logging-data="2768612"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+oMYiz07DhXRTtiHcWLwaP"; posting-host="2b0036cbabaf2649034a4c572a2df787" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) Cancel-Lock: sha1:+PvuTHEOr3OsTlaMzBTXOULdUcA= sha1:jzOhjs8n3FZufk52GQPEBGX1FMM= sha256:6bJp4gxIbrLRXGpJume9ctxDU78HdUH/OIfKrkA1BIs= sha1:CHNbE2Q56cpMIGV64iQmrbncuFU= sha256:FTtPW3h2oKLJ7K1n/ERcmXpr0NMAdjANpk8fe6ppRKc=