Skip to main content

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'

Metadata

Release files for stdcpp 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for stdcpp 0.5.0
File Size Uploaded
stdcpp-0.5.0.tar.gz 2.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for stdcpp 0.5.0
File Interpreter ABI Platform
stdcpp-0.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 4.4 kB

Release files / stdcpp-0.5.0.tar.gz

Download URL stdcpp-0.5.0.tar.gz
Size 2.0 kB
Tags Source
SHA-256 checksum
How to use checksums
64ed505970ea6780ac37f291ab0ce22543a958a1946dc90b0748ba1c056d52d9
BLAKE2b-256 checksum
How to use checksums
23d53a128a7586c8b46e69eb8cf7fef0bcf9053d00d7eb52510020450215f03e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.6.1 CPython/3.10.12 Linux/5.15.0-91-generic

Release files / stdcpp-0.5.0-py3-none-any.whl

Download URL stdcpp-0.5.0-py3-none-any.whl
Size 2.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7c6c691086cdce07edcb8c87d5b2e632df7034d12a8b6f68bb49d72c012bf0aa
BLAKE2b-256 checksum
How to use checksums
2f30068808dc6641dd9be9a323f08faa9523b6de7924a9e7ac8580e372d421c5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.6.1 CPython/3.10.12 Linux/5.15.0-91-generic

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page