Skip to main content

Implementing C++ Semantics in Python

Project description

cpp.py

Implementing C++ Semantics in Python

Disclaimer

This project is an experiment.

Please don't use it in any sensitive context.

Installation

From PyPI

pip install cpppy

From Source (Dev)

git clone https://github.com/tmr232/cpppy.git
cd cpppy
poetry install
poetry shell

Usage & Examples

Import magic inside a module and watch the magic happen.

Note that it only works inside modules. Importing it in an interactive shell or a Jupyter Notebook won't work.

That said, functions from said modules can be imported and used in regular Python code.

# examples/greeter.py

from cpp import magic


class Greeter:
    name: str

    public()

    def Greeter(name):
        this.name = name
        print(f"Hello, {this.name}!")

    def _Greeter():
        print(f"Goodbye, {this.name}.")


def main():
    greeter1 = Greeter(1)
    greetee2 = Greeter(2)
>>> python examples/greeter.py
Hello, 1!
Hello, 2!
Goodbye, 2.
Goodbye, 1.

Presentations

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

cpppy-1.0.0.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

cpppy-1.0.0-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file cpppy-1.0.0.tar.gz.

File metadata

  • Download URL: cpppy-1.0.0.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.8 CPython/3.7.4 Windows/10

File hashes

Hashes for cpppy-1.0.0.tar.gz
Algorithm Hash digest
SHA256 73b0e5d32a8878cac9b2f6c36be7161920fbe4f4c87262dafef518418ed5ee02
MD5 0e31ef759f58933e2d2912fae273a794
BLAKE2b-256 cf94fdd1c13007096905de8797598b50ee1d287a52f2b09b0d9bd120af870d85

See more details on using hashes here.

File details

Details for the file cpppy-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: cpppy-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 3.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.8 CPython/3.7.4 Windows/10

File hashes

Hashes for cpppy-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8c791ca52878fd436e27b2470a8a59046a4e7988b343f89c0b12f6720af8538f
MD5 a4953a9b439a740e926e6854caa6981c
BLAKE2b-256 3f0f30b34c9cf1658271377a8e0d066876ab599487495b70a7d7a1d2cc6ff0d8

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