Default scope of variables

Rotwang sg552 at hotmail.co.uk
Fri Jul 5 02:28:46 EDT 2013


On 05/07/2013 02:24, Steven D'Aprano wrote:
> On Thu, 04 Jul 2013 17:54:20 +0100, Rotwang wrote:
> [...]
>> Anyway, none of the calculations that has been given takes into account
>> the fact that names can be /less/ than one million characters long.
>
>
> Not in *my* code they don't!!!
>
> *wink*
>
>
>> The
>> actual number of non-empty strings of length at most 1000000 characters,
>> that consist only of ascii letters, digits or underscores, and that
>> don't start with a digit, is
>>
>> sum(53*63**i for i in range(1000000)) == 53*(63**1000000 - 1)//62
>
>
> I take my hat of to you sir, or possibly madam. That is truly an inspired
> piece of pedantry.

FWIW, I'm male.


>> It's perhaps worth mentioning that some non-ascii characters are allowed
>> in identifiers in Python 3, though I don't know which ones.
>
> PEP 3131 describes the rules:
>
> http://www.python.org/dev/peps/pep-3131/

Thanks.



More information about the Python-list mailing list