Functional programming

Chris Angelico rosuav at gmail.com
Tue Mar 4 10:28:17 EST 2014


On Wed, Mar 5, 2014 at 2:18 AM, Steven D'Aprano
<steve+comp.lang.python at pearwood.info> wrote:
> You don't need to have static typing to have declared variables. The two
> are independent. E.g. one might have a system like Python, except you
> have to declare your variables before using them:
>
> global x
> local a
> a = x+1

Aside: If you declare your locals, you shouldn't need to declare your
globals. Though I could imagine a rule that global rebinding still
needs to be declared, but you certainly shouldn't need to declare
nonlocal if you have a local declaration. Absence of local =>
nonlocal.

ChrisA



More information about the Python-list mailing list