Ad
Code
Diff
  • #include <iostream>
    import sys
    std = type(sys)('std')
    class stream(object):
        def __init__(self, f):
            self.f = f
        def __lshift__(self, s):
            self.f.write(s)
            return self
    
    std.cout = stream(sys.stdout)
    std.endl = '\r\n' if 'nt' in sys.builtin_module_names else '\n'
    
    std.cout << "Hello " << "Python!" << std.endl
    #What could be more maintainable?
    • from __future__ import print_function
    • print("Hello Python", end="!\n")
    • #include <iostream>
    • import sys
    • std = type(sys)('std')
    • class stream(object):
    • def __init__(self, f):
    • self.f = f
    • def __lshift__(self, s):
    • self.f.write(s)
    • return self
    • std.cout = stream(sys.stdout)
    • std.endl = '\r\n' if 'nt' in sys.builtin_module_names else '\n'
    • std.cout << "Hello " << "Python!" << std.endl
    • #What could be more maintainable?