Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!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; 'redirected': 0.07; 'subject:code': 0.07; 'python': 0.09; 'idea?': 0.09; 'cc:addr :python-list': 0.10; 'template': 0.11; 'question)': 0.16; 'readable': 0.16; 'silly': 0.16; 'wrote:': 0.17; 'code,': 0.18; 'app': 0.19; 'file.': 0.20; 'trying': 0.21; "i'd": 0.22; 'cc:2**0': 0.23; "i've": 0.23; 'cc:addr:python.org': 0.25; 'header :In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'appreciated.': 0.26; 'c++': 0.27; 'translated': 0.27; '(maybe': 0.29; "i'm": 0.29; 'knows': 0.30; 'sense': 0.31; 'code': 0.31; 'file': 0.32; 'anybody': 0.32; 'could': 0.32; 'received:google.com': 0.34; 'generic': 0.35; 'pm,': 0.35; 'something': 0.35; 'but': 0.36; 'message-id:@gmail.com': 0.36; 'received:74.125': 0.36; 'anything': 0.36; 'xml': 0.37; 'does': 0.37; 'quite': 0.37; 'subject:: ': 0.38; 'sure': 0.38; 'advice': 0.39; 'received:192': 0.39; 'google': 0.39; 'received:192.168': 0.40; 'header:Received:5': 0.40; 'think': 0.40; 'skip:u 10': 0.60; 'subject': 0.66 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=vgwBH0gHdadRDv9kIfu/ta+60w0fn3TlaeJxE6ygFec=; b=q+abdK5UmyXd/jPEhfbmzZ/FHZOr8I386AYy/O6YLjfBs/ojPumYJp9JPcJWaZ3pP3 7VtGc+rwRvdMGGdI8Wyc0jJ4iIr9dt1L5kseM5wwoG80dha6AHwyXD9hfNCSmie5/YMj 7Vue8DM4qXiFhQDSt89x7b4OJsjQ/E7Hh2yHlOO3qjIH8dxQIHwjfCbKStp1H6MdJhgI ydw3Czg6EkRM/ole0dz5/rkewrDbb7DNtdh38ON3D8FKb4fYByJtJMpWYNfj7ymnfaXQ nxa/+aIsldnkEdhm+F2fuVOojmWe+8sMaa3PDeTP/8AVMI2UWlRteH+HS7c86EkUmSKU WJaQ== Date: Tue, 09 Oct 2012 20:55:48 +0100 From: Andrea Crotti User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120910 Thunderbird/15.0.1 MIME-Version: 1.0 To: Jean-Michel Pichavant Subject: Re: Generating C++ code References: <594985467.3115693.1349798400166.JavaMail.root@sequans.com> In-Reply-To: <594985467.3115693.1349798400166.JavaMail.root@sequans.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Python mail-list 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: 26 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1349812615 news.xs4all.nl 6900 [2001:888:2000:d::a6]:48652 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:31053 On 10/09/2012 05:00 PM, Jean-Michel Pichavant wrote: > Greetings, > > I'm trying to generate C++ code from an XML file. I'd like to use a template engine, which imo produce something readable and maintainable. > My google search about this subject has been quite unsuccessful, I've been redirected to template engine specific to html mostly. > > Does anybody knows a python template engine for generating C++ code ? > > Here's my flow: > > XML file -> nice python app -> C++ code > > From what I know I could use Cheetah, a generic template engine. I never used it though, I'm not sure this is what I need. > I'm familiar with jinja2 but I'm not sure I could use it to generate C++ code, did anybody try ? (maybe that's a silly question) > > Any advice would be appreciated. > > JM I think you can use anything to generate C++ code, but is it a good idea? Are you going to produce this code only one time and then maintain it manually? And are you sure that the design that you would get from the XML file actually makes sense when translated in C++?