pythonl
Wat als je alleen maar Nederlandse woorden zou gebruiken voor python sleutel woorden?
Hier is mijn idee daar van:
- and: en
- as: als
- assert: eis
- async: async
- await: wachtop
- break: stop
- case: geval
- class: klasse
- continue: doorgaan
- def: def
- del: verwijder
- if: indien
- elif: andien
- else: anders
- except: behalve
- False: Onwaar
- finally: uiteindelijk
- for: voor
- from: van
- global: globaal
- import: importeer
- in: in
- is: is
- lambda: lambda
- match: vergelijk
- None: Niets
- nonlocal: nietlokaal
- not: niet
- or: of
- pass: pas
- raise: hef
- return: retour
- True: Waar
- try: probeer
- type: type
- while: zolang
- with: met
- yield: lever
Voorbeeld
def lees_nummers(bestand_naam):
nummers = []
met open(bestand_naam) als bestand:
voor lijn in bestand:
probeer:
nummers.append(int(lijn))
behalve:
doorgaan
retour nummers
nummers = lees_nummers("nummers.txt")
print(nummers)
En je kan dit nog echt uitvoeren ook!
pythonl voorbeeld.pynl
Installatie
pip install pythonl
Of installeer het van Github.
In dat geval vergeet niet om de afhankelijkheden in requirements.txt te installeren.
Dat is op dit moment alleen maar token_utils.
pip install -r requirements.txt
Dit project ondersteunt ook poetry.
Dus je kan ook de afhankelijkheden installeren met poetry install waarna je poetry run pythonl kan uitvoeren om pythonl uit te voeren.
Interactie met Python code
Pythonl code in .pynl bestanden werkt naadloos samen met Python in .py bestanden. Je kan .py bestanden gewoon importeren in je .pynl bestanden. Zie hoofd.pynl:
importeer fiben
importeer fibnl
print("Fibonacci(7) uit Engelse module:", fiben.fibonacci(7))
print("Fibonacci(7) uit Nederlandse module:", fibnl.fibonacci(7))
eis fiben.fibonacci(7) == fibnl.fibonacci(7)
Als je dit uitvoert met pythonl krijg je:
$ pythonl ./hoofd.pynl
# Fibonacci(7) uit Engelse module: 13
# Fibonacci(7) uit Nederlandse module: 13
Interactieve Shell
Er is ook een werkende pythonl shell.
$ pythonl
Pythonl (0.1.0) interactive shell 3.10.12 (main, Jul 31 2024, 01:37:00) [GCC 11.4.0]
>>>
🐍
$ ./pythonl ./pythonl.pynl ./hoofd.pynl
Fibonacci(7) uit Engelse module: 13
Fibonacci(7) uit Nederlandse module: 13
Metadata
Release files for pythonl 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pythonl-0.1.0.tar.gz | 18.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pythonl-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 36.7 kB
Release files / pythonl-0.1.0.tar.gz
| Download URL | pythonl-0.1.0.tar.gz |
|---|---|
| Size | 18.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c48c3a693b817daad2351fc37ab5c0d6926c9fccda696b56d0140c5be2da76f9
|
|
BLAKE2b-256 checksum How to use checksums |
0284cef9e6c65bdfccc8136de71ff7e80a7824d7f0b35873bd2de57322d87e75
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.2 CPython/3.10.12 Linux/6.9.3-76060903-generic
|
Release files / pythonl-0.1.0-py3-none-any.whl
| Download URL | pythonl-0.1.0-py3-none-any.whl |
|---|---|
| Size | 18.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e73b6fdbdedb29848cec404a17a01eb0e4921afd337a6d920851e719ee76c95b
|
|
BLAKE2b-256 checksum How to use checksums |
3526f316c0be6750794220e9ae5d6cbabf1239d38bdbe721b8ed09bcd527a7f0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.2 CPython/3.10.12 Linux/6.9.3-76060903-generic
|