Path: csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!194.109.133.87.MISMATCH!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!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.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'subject:Python': 0.06; 'parser': 0.07; 'suppose': 0.07; 'string': 0.09; 'impose': 0.09; 'literal': 0.09; 'subject:module': 0.09; 'subject:skip:c 10': 0.09; 'thats': 0.09; 'cc:addr:python-list': 0.11; "wouldn't": 0.14; '0),': 0.16; 'agreed,': 0.16; 'assignments': 0.16; 'contexts,': 0.16; 'docs.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'quoted': 0.16; 'subject:etc.': 0.16; 'subject:values': 0.16; 'followed': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'implementing': 0.19; 'code,': 0.22; 'programming': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'certain': 0.27; 'header:In-Reply-To:1': 0.27; 'feature': 0.29; 'am,': 0.29; 'mix': 0.30; 'message-id:@mail.gmail.com': 0.30; 'usually': 0.31; 'ok.': 0.31; 'subject:what': 0.31; 'probably': 0.32; 'stuff': 0.32; 'quite': 0.32; 'trouble': 0.34; 'sense': 0.34; "i'd": 0.34; 'requirement': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'subject:?': 0.36; 'effort': 0.37; 'being': 0.38; 'convention': 0.38; 'ends': 0.38; 'ability': 0.39; 'bad': 0.39; 'chain': 0.60; 'matter': 0.61; "you'll": 0.62; 'kind': 0.63; 'more': 0.64; 'subject:. ': 0.67; 'side': 0.67; 'hand': 0.80; 'bloody': 0.84; 'slope': 0.84; 'worth,': 0.84; 'to:none': 0.92; 'hand,': 0.93; 'imagine': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=8RAyVhw/JFnSQG9rpq/16xEK3F45C2l/XbVemgI66Qk=; b=ioS25eDGe71+fPAl+REmclTlfDkTZ8OHqgsB1jilYKFcwUz08rx3meXAV7pIPxE8Ss 1CHZDH6ub9b3H+C6hzJMpIbjrnPM5HVbsey/gbHubbDyAxrKuISE3ZfNZLgNRiqS5ODm KN299QLfDd1WTE0dLh/RlFBZZ7+lYa5EvOC5ck8ImygNi6LAIGWNazXQlzULiPHbb0Xi KZvkB77qgmEeHVLbDiPDXDFMjUaqR4CYoMQQ/wm7XLKFSp136FJRmwwlxy4fG9jKFaVU 2fs7V/fAz6SbB8rREtmx65HrUaIleDxEXcEyx9ya7C9udSCS99U1SFXq8zIIUEBexMih 56bA== MIME-Version: 1.0 X-Received: by 10.152.205.38 with SMTP id ld6mr5405743lac.97.1412099185611; Tue, 30 Sep 2014 10:46:25 -0700 (PDT) In-Reply-To: References: <54hqfb-nan.ln1@chris.zbmc.eu> <36d7ddca-29f4-403c-a64d-611e187afc3a@googlegroups.com> <2ea96bcf-e905-4d77-a105-82b27715aa6e@googlegroups.com> Date: Wed, 1 Oct 2014 03:46:25 +1000 Subject: Re: Keepin constants, configuration values, etc. in Python - dedicated module or what? From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 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: 21 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1412099193 news.xs4all.nl 2850 [2001:888:2000:d::a6]:56222 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:78500 On Wed, Oct 1, 2014 at 3:31 AM, Rustom Mody wrote: > On the other hand if you impose a convention: Constants file-module has > NOTHING but constants, thats a non-formal convention and thats ok. > > If however you mix it up with other (real) code, you'll get a bloody mess. > This kind of stuff "7*24*60*60" is borderline and in my experience > its a slippery slope that ends up being more trouble than its worth. Agreed, and which side of the border it's on is a matter of opinion. Suppose you were writing an INI-style parser - would you include this feature? I probably wouldn't include arithmetic, as it's usually more effort than it's worth, but it isn't a bad feature inherently. I'd definitely not include backreferencing (FOO = "bar", followed by FOO_LEN = len(FOO) or something), or the ability to chain assignments (FOO = BAR = 0), so those would be advised against in the convention docs. On the other hand, a quoted string requirement ("foo\nbar") makes a huge amount of sense in certain contexts, and I can imagine implementing quite a lot of a programming language's string literal syntax. ChrisA