Supported Features¶
Python Syntax¶
deffunction definitions with default arguments- Python operators:
and,or,not,in,not in,is,is not - List comprehensions:
[x * 2 for x in range(10) if x % 2 == 0] - Dictionary comprehensions:
{x: x**2 for x in range(5)} - Set comprehensions:
{x * 2 for x in range(5)} - Slicing:
my_list[1:5],my_string[::2] - Tuple support:
(1, 2, 3) - Multiple assignment:
a, b = 1, 2 - Tuple unpacking:
a, b = (1, 2) - Set literals:
{1, 2, 3} - Walrus operator:
(x := 5) globalkeyword for declaring global variables inside functionsnonlocalkeyword for declaring variables from enclosing scopesyieldkeyword for generator functions- Type hints:
def greet(name: str) -> str:,List[int],Callable[[int], str] try/except/finallyexception handlingraisestatement for throwing exceptionsmatch/casepattern matching (Python 3.10+)withstatement for context managementasync/awaitfor asynchronous programming...(ellipsis) literal- Bytes literals:
b"hello" - f-strings (basic support)
- Decorators:
@decoratorsyntax - Built-in decorators:
property(),staticmethod(),classmethod()
Note
Syntax is some as Python 3.1x, but some features from newer versions may be missing or partially supported.
Dunder Methods¶
__init__- Constructor__str__- String representation (str())__repr__- Representation__len__- Length (len())__add__- Addition operator (+)__sub__- Subtraction operator (-)__mul__- Multiplication operator (*)__truediv__- Division operator (/)__floordiv__- Floor division (//)__mod__- Modulo operator (%)__pow__- Power operator (**)__eq__- Equality (==)__ne__- Not equal (!=)__lt__- Less than (<)__gt__- Greater than (>)__le__- Less than or equal (<=)__ge__- Greater than or equal (>=)__contains__- Membership test (in)__getitem__- Indexing (obj[key])__call__- Callable objects
Limitations¶
Warning
Hython has quite a few limitations, but it's usable. Some has unlisted here, because I don't know implemented them yet, and I forgot to write them down.
- A lot non-important features are not implemented yet, such as
asyncio,threading,multiprocessing,socket,subprocess,osmodule, etc.