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


Groups > comp.lang.python > #46354

Re: Python #ifdef

References <BLU176-W12FAFEA3C7AFD687855E04D7970@phx.gbl>
Date 2013-05-28 18:23 -0700
Subject Re: Python #ifdef
From Dan Stromberg <drsalists@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.2336.1369790616.3114.python-list@python.org> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

Here're slides from a presentation about writing code that runs on 2.x and
3.x: http://stromberg.dnsalias.org/~dstromberg/Intro-to-Python/

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.

Sent from my android phone.
On May 28, 2013 12:47 PM, "Carlos Nepomuceno" <carlosnepomuceno@outlook.com>
wrote:

> 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?
> --
> http://mail.python.org/mailman/listinfo/python-list
>

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


Thread

Re: Python #ifdef Dan Stromberg <drsalists@gmail.com> - 2013-05-28 18:23 -0700
  Re: Python #ifdef Grant Edwards <invalid@invalid.invalid> - 2013-05-29 14:55 +0000
    Re: Python #ifdef Chris Angelico <rosuav@gmail.com> - 2013-05-30 01:05 +1000
      Re: Python #ifdef Grant Edwards <invalid@invalid.invalid> - 2013-05-29 15:25 +0000
      Re: Python #ifdef Erik Max Francis <max@alcyone.com> - 2013-06-02 16:57 -0700
        Re: Python #ifdef Roy Smith <roy@panix.com> - 2013-06-02 20:23 -0400
        Re: Python #ifdef Skip Montanaro <skip.montanaro@gmail.com> - 2013-06-02 19:29 -0500
        Re: Python #ifdef Chris Angelico <rosuav@gmail.com> - 2013-06-03 12:05 +1000

csiph-web