Skip to content

Example project to demonstrate interfacing Python and Rust.

License

Notifications You must be signed in to change notification settings

bast/pyo3-example-accounts

Repository files navigation

Example project to demonstrate interfacing Python and Rust

License

First install from test-PyPI:

$ pip install -i https://test.pypi.org/simple/ accounts

Then this should work:

from accounts import Account

account1 = Account(100.0)
account2 = Account(100.0)

account1.deposit(50.0)

account2.withdraw(25.0)

print("balance of account 1:", account1.get_balance())
print("balance of account 2:", account2.get_balance())