Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #7575
| Date | 2011-06-13 17:19 -0700 |
|---|---|
| From | John Nagle <nagle@animats.com> |
| Newsgroups | comp.lang.python |
| Subject | Re: Function declarations ? |
| References | <slrniuv00f.8s9.cheney@atc5.vermine.org> <e7913881-3028-4370-b4f5-7a7b17b04be0@h7g2000yqa.googlegroups.com> <slrniva5en.8s9.cheney@atc5.vermine.org> |
| Message-ID | <4df6a92e$0$2168$742ec2ed@news.sonic.net> (permalink) |
| Organization | Sonic.Net |
On 6/12/2011 12:38 PM, Andre Majorel wrote:
> On 2011-06-10, Asen Bozhilov<asen.bozhilov@gmail.com> wrote:
>> Andre Majorel wrote:
>>
>>> Is there a way to keep the definitions of the high-level
>>> functions at the top of the source ? I don't see a way to
>>> declare a function in Python.
>>
>> Languages with variable and function declarations usually use
>> hoisted environment.
>
> Hoisted ? With a pulley and a cable ?
There are languages with definitions and in which
the compiler looks ahead. FORTRAN, for example.
Python doesn't work that way. Nor do C and the
languages derived from it, because the syntax
is context-dependent. (In C++, "A b;" is ambiguous
until after the declaration of A. In
Pascal-derived languages, you write "var b: A;",
which is parseable before you know what A is.
So declarations don't have to be in dependency order.)
None of this is relevant to Python, but that's
what "hoisted" means in this context..
John Nagle
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Function declarations ? Andre Majorel <cheney@halliburton.com> - 2011-06-08 13:58 +0000
Re: Function declarations ? Calvin Spealman <ironfroggy@gmail.com> - 2011-06-08 10:06 -0400
Re: Function declarations ? "D'Arcy J.M. Cain" <darcy@druid.net> - 2011-06-08 10:27 -0400
Re: Function declarations ? Asen Bozhilov <asen.bozhilov@gmail.com> - 2011-06-10 15:46 -0700
Re: Function declarations ? Andre Majorel <cheney@halliburton.com> - 2011-06-12 19:38 +0000
Re: Function declarations ? Tim Roberts <timr@probo.com> - 2011-06-12 21:27 -0700
Re: Function declarations ? Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2011-06-14 14:03 +1200
Re: Function declarations ? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-06-13 14:58 +0000
Re: Function declarations ? Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2011-06-14 13:18 +1200
Re: Function declarations ? John Nagle <nagle@animats.com> - 2011-06-13 17:19 -0700
csiph-web