9

Student intern here. My boss recently asked me to replace several if-statements with preprocessor macros.

In Python.

And apparently, he didn‘t joke.

Comments
  • 2
    It's... Technically doable...
  • 1
    I had a little mozy on Stack Overflow, this made me chuckle:

    "Is there a way? Yes. There's always a way. Should you do it? Probably not."

    https://stackoverflow.com/a/...
  • 1
    Does the python to bytecode compiler preprocess math functions at compile time if no dependencies? I don't see anything about this anywhere for python itself. But you could technically do this with a module made with C.
  • 2
    @Demolishun it does "peephole optimization", restructuring loops, calculating constants, etc. So, yes
  • 6
    Made me think of the time a teacher told me to use switch statements as per her requirements. In Python. Whilst this is technically doable through functions, she later asked me if I was familiar with switch() {} as you see on most C style languages.

    She just did not wanted to understand that Python did not have that construct. The Dean talked to her stupid ass for me so it was ok.
Add Comment