🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.python
Article #212

Re: Python allowing future procedures declared, when was this change?

#212
From: Blaine
Date: Wed, 11 Nov 2026 01:12
40 lines
2486 bytes
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
Technical Details
Message-ID: <11d0feh$2ldc7$1@dont-email.me>
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
References: <11d0b12$2jvp1$1@dont-email.me> <87a4ngrz14.fsf@nightsong.com>

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: Blaine <cactus_DAC@yahoo.com>
Newsgroups: comp.lang.python
Subject: Re: Python allowing future procedures declared, when was this change?
Date: Tue, 10 Nov 2026 18:12:42 -0700
Organization: A noiseless patient Spider
Lines: 40
Message-ID: <11d0feh$2ldc7$1@dont-email.me>
References: <11d0b12$2jvp1$1@dont-email.me> <87a4ngrz14.fsf@nightsong.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 11 Nov 2026 01:12:49 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="2798983"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX18QyYjeTfrknFruvytu6IyhxmTfbrA6oMw="; posting-host="1e1fdc2a238715221cc75c5f723bad6a"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101
 Firefox/140.0 SeaMonkey/2.53.24
Cancel-Lock: sha1:l6qkzhyJbufd6deDLWlDCpo4KEs= sha256:sCpjtaJyqIn+E+LGm8gNEm5XLo3Iov7C3kHCKhRxwI0=
	sha1:TB0rP9lr14t7Yde8XMg1jVtWbbI= sha256:2RdqgIy6ZQ93h1OBdzqOPvT4ZbjScNWoDXLiZfvSx9U=
In-Reply-To: <87a4ngrz14.fsf@nightsong.com>