Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Antoon Pardon Newsgroups: comp.lang.python Subject: Re: static variables Date: Wed, 02 Dec 2015 09:21:49 +0100 Lines: 13 Message-ID: References: <565cf163$0$1612$c3e8da3$5496439d@news.astraweb.com> <565e4329$0$1612$c3e8da3$5496439d@news.astraweb.com> <565e4861$0$1587$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de PoiXMdlgdsY+kgjchQelYgzAALwYwgaRFNRt8dJD+//Q== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.015 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'static': 0.03; 'received:134': 0.05; 'executable': 0.07; 'python': 0.10; 'python.': 0.11; 'declaration': 0.16; 'received:ac.be': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'somewhere.': 0.16; 'statement.': 0.16; 'variable': 0.18; 'function,': 0.22; 'header :In-Reply-To:1': 0.24; 'header:User-Agent:1': 0.26; 'received:be': 0.30; 'statement': 0.32; 'problem': 0.33; 'steven': 0.33; 'but': 0.36; 'instead': 0.36; 'totally': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'really': 0.37; 'goes': 0.39; 'to:addr:python.org': 0.40; 'your': 0.60; 'body': 0.61; 'skip:n 10': 0.62; 'great': 0.63; 'obvious': 0.76; "d'aprano:": 0.84; 'schreef': 0.84 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AucIABCpXlaGuA9G/2dsb2JhbABehFYBv0KBFIYOAoIYAQEBAQEBgUwOAYNlAQEEI2YLGgIFIQICDwJGEwgCF4gUrWqMfoQFAQEIAiGBAYVThH2FJ4JOgUQFllyNO4FbhzaPZ4NyY4QFhRCBUAEBAQ User-Agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Icedove/31.8.0 In-Reply-To: <565e4861$0$1587$c3e8da3$5496439d@news.astraweb.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:99848 Op 02-12-15 om 02:24 schreef Steven D'Aprano: > Python has three not-entirely-awful solutions to the problem of static > locals, but no really great or obvious one. I think python is unsuited for an obvious solution for static locals. Because you need to initialise your static variable somewhere. If you initialise whithin the body of your function, you will have a statement that is essentialy a declaration instead of an executable statement. Which goes totally against the dynamic nature op python. -- Antoon