Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!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.011 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'context': 0.05; 'subject:skip:c 10': 0.07; 'apache,': 0.09; 'doubles': 0.09; 'namespace': 0.09; 'python': 0.10; 'syntax': 0.13; 'variables': 0.15; 'from:addr:torriem': 0.16; 'from:name:michael torrie': 0.16; 'wrote:': 0.16; 'config': 0.18; 'module,': 0.18; 'say,': 0.18; 'aug': 0.20; 'needed.': 0.23; "python's": 0.23; 'import': 0.24; 'written': 0.24; 'header:In-Reply-To:1': 0.24; 'module': 0.25; 'header:User-Agent:1': 0.26; 'error': 0.27; 'checking': 0.27; 'mostly': 0.27; 'consisting': 0.29; 'robust': 0.29; 'reporting': 0.29; 'certainly': 0.30; 'another': 0.32; 'subject:) ': 0.32; 'michael': 0.33; 'errors,': 0.33; 'message-id:@gmail.com': 0.34; 'editor': 0.34; 'tue,': 0.34; 'file': 0.34; 'could': 0.35; 'text': 0.35; 'exist': 0.35; "isn't": 0.35; 'but': 0.36; 'basic': 0.36; 'modules': 0.36; 'tools,': 0.36; 'to:addr:python-list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'enough': 0.39; 'received:192': 0.39; 'well.': 0.40; 'to:addr:python.org': 0.40; 'still': 0.40; 'some': 0.40; 'your': 0.60; 'programs': 0.62; 'charset:windows-1252': 0.62; 'sharing': 0.64; 'between': 0.65; 'worth': 0.67; 'complication': 0.84; 'dsl': 0.84 X-Virus-Scanned: amavisd-new at torriefamily.org Date: Tue, 04 Aug 2015 22:48:51 -0600 From: Michael Torrie User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Most Pythonic way to store (small) configuration References: <87k2teq9tb.fsf@Equus.decebal.nl> <663ad259-48e0-4eec-a946-7cd03805ddb1@googlegroups.com> <85y4hqkepb.fsf@benfinney.id.au> <55C16796.9060101@gmail.com> <1438742671.36658.348000713.4F778711@webmail.messagingengine.com> In-Reply-To: <1438742671.36658.348000713.4F778711@webmail.messagingengine.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit 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: , Newsgroups: comp.lang.python Message-ID: Lines: 19 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1438750137 news.xs4all.nl 2886 [2001:888:2000:d::a6]:58298 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:94991 On 08/04/2015 08:44 PM, random832@fastmail.us wrote: > On Tue, Aug 4, 2015, at 21:32, Michael Torrie wrote: >> In many of my projects I put basic config variables in a file like >> config.py and import that in each module that needs it. The config >> module doubles as a global namespace for sharing between modules as well. > > What about JSONP? That is, a file consisting exactly of "config_data = > [JSON object]" That would get you some of the benefits of having your > config file exist as a python module, but still allow it to be examined > by other tools, written out, etc. But I don't need it to be examined by other tools. So the added complication of yet another layer isn't worth it or needed. Python's syntax is simple enough that a person with a text editor can certainly do it. Again, context is everything. My programs are written for mostly my own use. If I was writing a system that was like, say, Apache, I would certainly do a DSL with a robust error checking and reporting system that could clearly help people with syntax errors, etc.