Skip to content

Instantly share code, notes, and snippets.

@qexat
Created December 14, 2023 02:27
Show Gist options
  • Select an option

  • Save qexat/1d6e334a5dd23b28ec05f0d6a60aa812 to your computer and use it in GitHub Desktop.

Select an option

Save qexat/1d6e334a5dd23b28ec05f0d6a60aa812 to your computer and use it in GitHub Desktop.
cppython
# pyright: reportUnusedExpression = false
import dataclasses
import os
import sys
import typing
@dataclasses.dataclass(slots=True)
class CPPFile:
file: typing.TextIO
def __lshift__(self, string: str, /) -> typing.Self:
self.file.write(string)
return self
cout = CPPFile(sys.stdout)
endl = "\n"
EXIT_SUCCESS = os.EX_OK
def main() -> int:
cout << "Hello World!" << endl
return EXIT_SUCCESS
if __name__ == "__main__":
raise SystemExit(main())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment