Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #46354 > unrolled thread
| Started by | Dan Stromberg <drsalists@gmail.com> |
|---|---|
| First post | 2013-05-28 18:23 -0700 |
| Last post | 2013-06-03 12:05 +1000 |
| Articles | 8 — 6 participants |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
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
| From | Dan Stromberg <drsalists@gmail.com> |
|---|---|
| Date | 2013-05-28 18:23 -0700 |
| Subject | Re: Python #ifdef |
| Message-ID | <mailman.2336.1369790616.3114.python-list@python.org> |
[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 >
[toc] | [next] | [standalone]
| From | Grant Edwards <invalid@invalid.invalid> |
|---|---|
| Date | 2013-05-29 14:55 +0000 |
| Message-ID | <ko54sm$c5b$2@reader1.panix.com> |
| In reply to | #46354 |
On 2013-05-29, Dan Stromberg <drsalists@gmail.com> 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...
--
Grant Edwards grant.b.edwards Yow! Hmmm ... a CRIPPLED
at ACCOUNTANT with a FALAFEL
gmail.com sandwich is HIT by a
TROLLEY-CAR ...
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2013-05-30 01:05 +1000 |
| Message-ID | <mailman.2361.1369839938.3114.python-list@python.org> |
| In reply to | #46388 |
On Thu, May 30, 2013 at 12:55 AM, Grant Edwards <invalid@invalid.invalid> wrote: > On 2013-05-29, Dan Stromberg <drsalists@gmail.com> 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
[toc] | [prev] | [next] | [standalone]
| From | Grant Edwards <invalid@invalid.invalid> |
|---|---|
| Date | 2013-05-29 15:25 +0000 |
| Message-ID | <ko56m4$e4j$1@reader1.panix.com> |
| In reply to | #46389 |
On 2013-05-29, Chris Angelico <rosuav@gmail.com> wrote:
> On Thu, May 30, 2013 at 12:55 AM, Grant Edwards <invalid@invalid.invalid> wrote:
>> On 2013-05-29, Dan Stromberg <drsalists@gmail.com> 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,
> [...]
> But still, GNU M4 is a decent piece of technology.
I didn't mean to disparage m4 -- it always seemed well thought out and
useful. It just happens to be associated with unpleasant things for
me. [And it didn't really seem like a good option for the OP's
problem.]
Still, if one really did want a preprocessor for Python programs, m4
would be the first thing I'd look at.
--
Grant Edwards grant.b.edwards Yow! I wonder if I ought
at to tell them about my
gmail.com PREVIOUS LIFE as a COMPLETE
STRANGER?
[toc] | [prev] | [next] | [standalone]
| From | Erik Max Francis <max@alcyone.com> |
|---|---|
| Date | 2013-06-02 16:57 -0700 |
| Message-ID | <n4mdnZkIOrRTRjbMnZ2dnUVZ5gOdnZ2d@giganews.com> |
| In reply to | #46389 |
On 05/29/2013 08:05 AM, Chris Angelico wrote:
> 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.
Agreed. The terror that most people feel when hearing "m4" is because
m4 was associated with sendmail, not because m4 was inherently awful.
It has problems, but you'd only encounter them when doing something
_very_ abstract.
--
Erik Max Francis && max@alcyone.com && http://www.alcyone.com/max/
San Jose, CA, USA && 37 18 N 121 57 W && AIM/Y!M/Jabber erikmaxfrancis
Substance is one of the greatest of our illusions.
-- Sir Arthur Eddington
[toc] | [prev] | [next] | [standalone]
| From | Roy Smith <roy@panix.com> |
|---|---|
| Date | 2013-06-02 20:23 -0400 |
| Message-ID | <roy-A8EB61.20231402062013@news.panix.com> |
| In reply to | #46740 |
In article <n4mdnZkIOrRTRjbMnZ2dnUVZ5gOdnZ2d@giganews.com>, Erik Max Francis <max@alcyone.com> wrote: > On 05/29/2013 08:05 AM, Chris Angelico wrote: > > 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. > > Agreed. The terror that most people feel when hearing "m4" is because > m4 was associated with sendmail Arrrrggghhh. You had to go and dredge up those bad memories? I hadn't thought about sendmail config files in years. I'll probably never be able to get to sleep tonight.
[toc] | [prev] | [next] | [standalone]
| From | Skip Montanaro <skip.montanaro@gmail.com> |
|---|---|
| Date | 2013-06-02 19:29 -0500 |
| Message-ID | <mailman.2569.1370219365.3114.python-list@python.org> |
| In reply to | #46740 |
[Multipart message — attachments visible in raw view] — view raw
> The terror that most people feel when hearing "m4" is because m4 was associated with sendmail, not because m4 was inherently awful. In fact, m4 made sendmail configs easier to maintain. Skip
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2013-06-03 12:05 +1000 |
| Message-ID | <mailman.2573.1370225159.3114.python-list@python.org> |
| In reply to | #46740 |
On Mon, Jun 3, 2013 at 9:57 AM, Erik Max Francis <max@alcyone.com> wrote: > On 05/29/2013 08:05 AM, Chris Angelico wrote: >> >> 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. > > > Agreed. The terror that most people feel when hearing "m4" is because m4 > was associated with sendmail, not because m4 was inherently awful. It has > problems, but you'd only encounter them when doing something _very_ > abstract. Ah. I actually wasn't aware of m4's use with sendmail. I first met it as the aforementioned PHP preprocessor, simply by Googling for something along the lines of "generic preprocessor". First hit solved my problems. ChrisA
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web