Default scope of variables
neilc at norwich.edu
Fri Jul 5 15:24:43 CEST 2013
On 2013-07-04, Dave Angel <davea at davea.name> wrote:
> On 07/04/2013 01:32 AM, Steven D'Aprano wrote:
>> Well, if I ever have more than 63,000,000 variables in a
>> function, I'll keep that in mind.
>>  Based on empirical evidence that Python supports names
>> with length at least up to one million characters long, and
>> assuming that each character can be an ASCII letter, digit or
> Well, the number wouldn't be 63,000,000. Rather it'd be
You should really count only the ones somebody might actually
want to use. That's a much, much smaller number, though still
Inner scopes (I don't remember the official name) is a great
feature of C++. It's not the right feature for Python, though,
since Python doesn't have deterministic destruction. It wouldn't
buy much except for namespace tidyness.
for x in range(4):
print(x) # Vader NOoooooOOOOOO!!!
Python provides deterministic destruction with a different
More information about the Python-list