Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #46348

Re: Python #ifdef

X-Received by 10.224.205.138 with SMTP id fq10mr330899qab.1.1369782266461; Tue, 28 May 2013 16:04:26 -0700 (PDT)
X-Received by 10.50.109.228 with SMTP id hv4mr10414igb.2.1369782266210; Tue, 28 May 2013 16:04:26 -0700 (PDT)
Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!p1no1271184qaj.0!news-out.google.com!y6ni57036qax.0!nntp.google.com!ch1no2658706qab.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups comp.lang.python
Date Tue, 28 May 2013 16:04:25 -0700 (PDT)
In-Reply-To <mailman.2317.1369770400.3114.python-list@python.org>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=123.192.32.215; posting-account=5JdMBQoAAABHnS4mjpqEzxnmWtgiiVNw
NNTP-Posting-Host 123.192.32.215
References <mailman.2317.1369770400.3114.python-list@python.org>
User-Agent G2/1.0
MIME-Version 1.0
Message-ID <aabfb355-7210-44a5-9576-357bc82abb47@googlegroups.com> (permalink)
Subject Re: Python #ifdef
From 88888 Dihedral <dihedral88888@gmail.com>
Injection-Date Tue, 28 May 2013 23:04:26 +0000
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
Xref csiph.com comp.lang.python:46348

Show key headers only | View raw


Carlos Nepomuceno於 2013年5月29日星期三UTC+8上午3時46分37秒寫道:
> Are there Python 'preprocessor directives'?
> 
> I'd like to have something like '#ifdef' to mix code from Python 2 and 3 in a single file.
> 
> Is that possible? How?

Use execfile(filename) at the beginning to get what you want.
The .pyc version is preferred.

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Python #ifdef Carlos Nepomuceno <carlosnepomuceno@outlook.com> - 2013-05-28 22:46 +0300
  Re: Python #ifdef 88888 Dihedral <dihedral88888@gmail.com> - 2013-05-28 16:04 -0700

csiph-web