Python Finally Adds C++ Iostreams
Python finally adds C++ iostreams support #python #cplusplus #programming reddit.com/r/ Python/comme... class Cout: def __lshift__(self, other): print(other, end="") return self def __rrshift__(self, other): print(other, end="") return self class Endl: def __rrshift__(self, other): return other + "\n" def __str__(self): return "\n" cout = Cout() endl = Endl() cout << "C++ printing in python" << endl endl >> "Works even this way!" >> cout
A social media screenshot jokes that Python has gained C++-style iostream syntax. The code humorously overloads shift operators so `cout <<` and `endl >>` appear to work in Python, parodying C++ programming conventions. It is shared as a reaction to absurd, over-engineered, or enthusiastically cross-language programming ideas. EN: A social media screenshot jokes that Python has gained C++-style iostream syntax. The code humorously overloads shift operators so `cout <<` and `endl >>` appear to work in Python, parodying C++ programming conventions. It is shared as a reaction to absurd, over-engineered, or enthusiastically cross-language programming ideas.
- @ithueti / 6798 2022-06-24
- Template
- Twitter/X screenshot
- Type
- image
- Size
- 520×800 · 58.9 KiB
- Mood
- absurd, sarcastic
- Language
- en
- Added