Skip to main content

cout & cerr like in C++

Project description

cout & cerr like in C++

Usge:

from stdcpp import cout, cerr, endl

cout << "Hello" << " " << "world!" << endl
cerr << "Hello" << " " << "world!" << endl

Bonus 1:

from stdcpp import Stream

s = Stream('log.txt', 'a+')
s << "Hello "
s.close()

with Stream('log.txt', 'a+') as s:
    s << "world!" << endl

Bonus 2:

import io
from stdcpp import Stream, cout

ios = io.StringIO()
s = Stream(ios)
s << "Hello world!" << endl
ios.seek(0)
cout << ios.read()

Bonus 3:

from stdcpp import coutln, cerrln

coutln << "Hello world!"
cerrln << "Hello world!"

Bonus 4:

from stdcpp import cdbg

x = 123
y = 'foobar'

cdbg << x << y

result:

x: int = 123
y: str = 'foobar'

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stdcpp-0.5.0.tar.gz (2.0 kB view details)

Uploaded Source

Built Distribution

stdcpp-0.5.0-py3-none-any.whl (2.4 kB view details)

Uploaded Python 3

File details

Details for the file stdcpp-0.5.0.tar.gz.

File metadata

  • Download URL: stdcpp-0.5.0.tar.gz
  • Upload date:
  • Size: 2.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.10.12 Linux/5.15.0-91-generic

File hashes

Hashes for stdcpp-0.5.0.tar.gz
Algorithm Hash digest
SHA256 64ed505970ea6780ac37f291ab0ce22543a958a1946dc90b0748ba1c056d52d9
MD5 6c44b93864c2fcb8e098f3a21e4e24c2
BLAKE2b-256 23d53a128a7586c8b46e69eb8cf7fef0bcf9053d00d7eb52510020450215f03e

See more details on using hashes here.

File details

Details for the file stdcpp-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: stdcpp-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 2.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.10.12 Linux/5.15.0-91-generic

File hashes

Hashes for stdcpp-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7c6c691086cdce07edcb8c87d5b2e632df7034d12a8b6f68bb49d72c012bf0aa
MD5 dc16bc90c387833d279455e466e0a877
BLAKE2b-256 2f30068808dc6641dd9be9a323f08faa9523b6de7924a9e7ac8580e372d421c5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page