Path: csiph.com!usenet.pasdenom.info!gegeweb.org!newsfeed.kamp.net!newsfeed.kamp.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'ascii': 0.09; 'assuming': 0.09; 'function,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'variables.': 0.09; 'wrong,': 0.09; 'python': 0.11; 'mostly': 0.14; "wouldn't": 0.14; 'digits)': 0.16; 'identifiers': 0.16; 'non-ascii': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-ipconnect.de': 0.16; 'underscore.': 0.16; 'underscores,': 0.16; 'wrote:': 0.18; '(the': 0.22; '>>>': 0.22; 'header:User-Agent:1': 0.23; 'mind.': 0.24; 'looks': 0.24; 'long,': 0.26; 'least': 0.26; 'header:X-Complaints- To:1': 0.27; '[1]': 0.29; 'am,': 0.29; 'character': 0.29; 'characters': 0.30; "d'aprano": 0.31; 'long.': 0.31; 'ones.': 0.31; 'steven': 0.31; 'probably': 0.32; 'actual': 0.34; 'but': 0.35; 'consist': 0.36; "i'll": 0.36; 'too': 0.37; 'to:addr:python- list': 0.38; 'fact': 0.38; 'rather': 0.38; 'skip:8 10': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'dave': 0.60; 'most': 0.60; 'length': 0.61; 'more': 0.64; 'account': 0.65; 'worth': 0.66; 'winner': 0.74; 'million': 0.74; '180': 0.84; 'calculations': 0.84; 'characters,': 0.84; "it'd": 0.84; 'angel': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Peter Otten <__peter__@web.de> Subject: Re: Default scope of variables Date: Thu, 04 Jul 2013 20:36:16 +0200 Organization: None References: <51d4eb9c$0$29999$c3e8da3$5496439d@news.astraweb.com> <51d508ed$0$6512$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7Bit X-Gmane-NNTP-Posting-Host: p5084970b.dip0.t-ipconnect.de User-Agent: KNode/4.7.3 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 50 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1372962958 news.xs4all.nl 15960 [2001:888:2000:d::a6]:48488 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:49895 Rotwang wrote: > Sorry to be OT, but this is sending my pedantry glands haywire: We are mostly pedants, too -- so this is well-deserved... > On 04/07/2013 08:06, Dave Angel wrote: >> On 07/04/2013 01:32 AM, Steven D'Aprano wrote: >>> >> >>> >>> Well, if I ever have more than 63,000,000 variables[1] in a function, >>> I'll keep that in mind. >>> >> >>> >>> [1] 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 underscore. >>> >> >> Well, the number wouldn't be 63,000,000. Rather it'd be 63**1000000 >> >> I probably have it wrong, but I think that looks like: >> >> 859,122,[etc.] >> >> >> variables. (The number has 180 digits) > > That's 63**100. Note that 10**1000000 has 1000001 digits, and is > somewhat smaller than 63**1000000. > > Anyway, none of the calculations that has been given takes into account > the fact that names can be /less/ than one million characters long. I think we have a winner ;) > 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 > It's perhaps worth mentioning that some non-ascii characters are allowed > in identifiers in Python 3, though I don't know which ones.