Expand description
Benda Module
This module provides functionality for working with Bend code, including loading and parsing Bend books, and compiling Python functions to Bend code at runtime.
The module includes functions for loading Bend books from strings or files, as well as
the PyBjit
class, which serves as an annotation for compiling Python functions to Bend code.
§Key Components
load_book
: Load a Bend book from a string of Bend codeload_book_from_file
: Load a Bend book from a filePyBjit
: Annotation class for compiling Python functions to Bend code at runtime
§Examples
from benda import bjit, load_book
# Load a Bend book from a string
book = load_book("some bend code here")
# Use the bjit annotation to compile a Python function to Bend code
@bjit
def add(x, y):
return x + y
result = add(1, 2) # This will execute the Bend-compiled version of the function
print(result) # Output: 3
# Load a Bend book from a file
book_from_file = load_book_from_file("/path/to/bend/file.bend")
§Note
This module integrates Python and Bend, allowing for seamless interaction between the two languages. It’s particularly useful for projects that need to leverage Bend’s capabilities while working within a Python environment.
Modules§
Structs§
- PyBjit
- Bjit decorator
Functions§
- load_
book - Load a Book from a string of Bend code
- load_
book_ from_ file - Load a Book from a file