hdytto: How do you turn this on
A library adding new syntax into your Python. i.e. It is NOT Pythonic :)
Compatibility
- Python >=3.8
Getting Started
Install from PyPI:
$ pip install hdytto
This library cannot be used by import hdytto as in other libraries, but the usage is simple. At first, make sitecustomize.py:
from hdytto import register_hdytto
register_hdytto()
Set the environmental variable PYTHONPATH the path to the directory containing the sitecustomize.py (e.g. export PYTHONPATH=.).
Then, run main.py:
# coding: hdytto
a = 5
print(a++)
print(a)
The output will be
5
6
REPL
Additionally, make .pythonrc.py:
import sys
import sitecustomize
sys.stdin.reconfigure(encoding='hdytto')
Set the environmental variable PYTHONSTARTUP the path to this .pythonrc.py (e.g. export PYTHONSTARTUP=.pythonrc.py).
Then, type python:
$ python
>>> a = 5
>>> a++
5
>>> do:
... b = ++a
... while b < 10
...
>>> b
10
hdytto Reference
Increment / Decrement
Syntax
x++
++x
x--
--x
Example
# coding: hdytto
a = 5
print(a++)
print(++a)
b = 10 - --a
print(b--)
Output:
5
7
4
do...while
Syntax
do:
statement
while condition
Example
# coding: hdytto
do:
a = 5
while a < 3
do:
b = a * 2
while a++ < 10:
pass
while b <= 20
print(b)
Output:
22
Comment
Syntax
/* */
Example
# coding: hdytto
a = /* foo */ 10
print(a)
if a == 10:
b = 5
/*b = 10
print(a - 20)*/
print(b)
Output:
10
5
const
Syntax
const name = value
Example
# coding: hdytto
import time
def foo(x, const y):
y = 20
print(x + y)
print('long time process here.')
const a = 30
time.sleep(a) # a process requiring long time
foo(1, 2)
Output:
File "main.py", line 6
y = 20
^
SyntaxError: invalid assignment to const y
SyntaxError: encoding problem: hdytto
This is SyntaxError, so does not require running the process requiring long time.
Caution
hdytto's const only prohibits =, +=, -=, *=, /=, %=, &=, |=, ^=, <<=, >>=, **=, //=, @=, :=, otherwise is allowed (e.g. const l = [] and l.append(5) is allowed).
Metadata
Release files for hdytto 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| hdytto-0.2.1.tar.gz | 8.4 kB | Without provenance | Details for hdytto-0.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| hdytto-0.2.1-py3-none-any.whl | Python 3 | none | any | Details for hdytto-0.2.1-py3-none-any.whl |
Total release size: 17.1 kB
Release files / hdytto-0.2.1.tar.gz
| Download URL | hdytto-0.2.1.tar.gz |
|---|---|
| Size | 8.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ae3095c12ae7ae46e674c61a3929bfb8640b2489b5c9f7bb387f7586b1cb9207
|
|
BLAKE2b-256 checksum How to use checksums |
a8f46f77dcc872a9303dd8212e3e2d8c23611ba4daf4ebef175a376006ed6750
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.9.1
|
Release files / hdytto-0.2.1-py3-none-any.whl
| Download URL | hdytto-0.2.1-py3-none-any.whl |
|---|---|
| Size | 8.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c5486a00e0fa0079eca0083bc1a9345e738b7091cb30b6a4362252ab63e191a0
|
|
BLAKE2b-256 checksum How to use checksums |
69c729f5a99a418393c7d1b0f92eb9001928df125840e38bb83236e0633edad7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.9.1
|
Security for hdytto 0.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.