Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

  #ifdef _cplusplus
      #include <iostream>
      #define print() int main(){cout << "Hello world! -- from C++" << endl;}
  #elif (defined __STDC__) || (defined __STDC_VERSION__)
      #include <stdio.h>
      #define print() int main(){printf("Hello world! -- from C\n");}
  #else
  import builtins
  print = lambda : builtins.print("Hello world! -- from Python")
  #endif
  
  print()
Some python code works in C and C++ as well but people don't group them together and call Python/C/C++


You must admit that C/Python doesn't quite have the same cachet as C/C++. C & C++ also share the same name, C++ was born as a derivative of C (with classes), they have the same syntax, logical constructs etc. Python is not even a systems language.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: