Path: csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!usenet-fr.net!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed3.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.011 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'url:pypi': 0.03; 'subject:Python': 0.06; 'dan': 0.09; 'makefile': 0.09; 'python': 0.11; 'language,': 0.12; "wouldn't": 0.14; "'include'": 0.16; 'directive': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'retained': 0.16; 'tool.': 0.16; '(you': 0.16; 'wrote:': 0.18; 'thu,': 0.19; 'example': 0.22; '(in': 0.22; 'config': 0.24; 'sort': 0.25; 'source': 0.25; 'class.': 0.26; 'mention': 0.26; 'header:In-Reply-To:1': 0.27; 'wondering': 0.29; 'am,': 0.29; "doesn't": 0.30; 'technology.': 0.30; 'message- id:@mail.gmail.com': 0.30; 'comments': 0.31; 'that.': 0.31; 'piece': 0.31; 'file': 0.32; 'class': 0.32; 'url:python': 0.33; 'received:209.85': 0.35; 'received:209.85.220': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'building': 0.35; 'doing': 0.36; 'url:org': 0.36; 'requirements': 0.37; 'received:209': 0.37; 'being': 0.38; 'system,': 0.38; 'stopped': 0.38; 'to:addr:python- list': 0.38; 'files': 0.38; 'issue': 0.38; 'bad': 0.39; 'to:addr:python.org': 0.39; 'improved': 0.60; 'middle': 0.60; 'numbers': 0.61; '30,': 0.65; 'linked': 0.65; 'edwards': 0.91; 'wanting': 0.93; 'subject: #': 0.96; '2013': 0.98 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:to :content-type; bh=PFBQlucKsclNeGcDjYbxIh81VKDMwhJrRmuWHePFrLQ=; b=UqCo31pT0h+AqaMN+UVfd1iN0sJPGsIwG+f1bwy2RPSGXrMNxD8qEiCgBtSXwX5dEA 2rHlCx7Q5DibEnVMnDvmfHPUp5iDi5HxlSWp3pMJGOV1BFLDgQ5To+v0n3EZ9kqBCr9A 9+2AmcJH2N2wimuOCfuhpKi7mu/794Jf3TkvSuDX5HEsXj0CEztqnsFecc9IYrgW+IqB 1gfI9CFLztcaGMARjtDnDO74PCWC29wtO8ntH88Zp43vOW83Rj0zHzo+k78GfTjUWG8X jzOymQyUDLlAmg/dTeCY44691CdFD9iSJsgWRqjvEuaRdnC6lWFwc8cYfDy1pUZwBfUr fHxg== MIME-Version: 1.0 X-Received: by 10.52.155.67 with SMTP id vu3mr1537245vdb.94.1369839935392; Wed, 29 May 2013 08:05:35 -0700 (PDT) In-Reply-To: References: Date: Thu, 30 May 2013 01:05:35 +1000 Subject: Re: Python #ifdef From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 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: 23 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1369839938 news.xs4all.nl 15928 [2001:888:2000:d::a6]:59634 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:46389 On Thu, May 30, 2013 at 12:55 AM, Grant Edwards wrote: > On 2013-05-29, Dan Stromberg wrote: > >> And in case you still want a preprocessor for Python (you likely don't need >> one this time), here's an example of doing this using the venerable m4: >> https://pypi.python.org/pypi/red-black-tree-mod . Note the many comments >> added to keep line numbers consistent. > > I was wondering whether or not to mention m4. Since m4 is (in my > mind) inextricably linked to RATFOR and sendmail config files I try > to avoid thinking about it lest the flashbacks start again... It's not a bad tool. I used it as a sort of PHP preprocessor, because requirements at work had me wanting to have a source file defining a PHP class and having an autogenerated section in the middle of that class. PHP's 'include' directive doesn't work for that. Of course, had we been using a better language, that wouldn't have been an issue (and it stopped being an issue when we improved the design and stopped using that class system, too, though I retained the makefile directives about building .php.m4 -> .php files). But still, GNU M4 is a decent piece of technology. ChrisA