Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python.announce > #2129 > unrolled thread
| Started by | "Peter V. Saveliev" <peter@svinota.eu> |
|---|---|
| First post | 2016-05-06 21:34 +0200 |
| Last post | 2016-05-06 21:34 +0200 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python.announce
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
ANN: fjorton-0.1, the initial release "Peter V. Saveliev" <peter@svinota.eu> - 2016-05-06 21:34 +0200
| From | "Peter V. Saveliev" <peter@svinota.eu> |
|---|---|
| Date | 2016-05-06 21:34 +0200 |
| Subject | ANN: fjorton-0.1, the initial release |
| Message-ID | <mailman.507.1462698407.32212.python-announce-list@python.org> |
fjorton-0.1
-----------
description
===========
The `fjorton` library is not so serious tool to extend the
Python syntax with stack features inspired by the Forth
language.
By default the Python interpreter drops all the data that
is not used in assignments or as function arguments::
c = 5
def f(a, b):
'''
This function does almost nothing. The only
result may be NameError, if <c> is not defined
at the execution time.
'''
a
b
c
f(3, 4)
The `@fjorton` decorator disassembles the function's bytecode
using `byteplay` library and changes it so all such references
store variables and objects into the hidden stack. And if
the name referenced is callable, it will be called with the
stack as the only positional argument. Statements `return` and
`return None` are changed to return the stack instead::
from fjorton import fjorton
def add(stack):
stack.append(stack.pop() + stack.pop())
@fjorton
def f(a, b):
a
b
add
print(f(2, 2)) # → [4]
rationale
=========
The library is written just for fun. No, seriously, you should
not use it in production. It works yet only for Python2 (Python3
support may be implemented later), it screws the bytecode, it
turns debugging into hell, it's not pythonic after all.
The only reasons to use it may be just to have some fun or to
troll colleagues (though that's a bit late for the 1st April joke,
but maybe the next year?)
links
=====
GitHub: https://github.com/svinota/fjorton
Docs: only readme for now
…
<P><A HREF="https://github.com/svinota/fjorton">Fjorton 0.1</A> — stack
programming in Python. (06-Maj-16)</P>
Back to top | Article view | comp.lang.python.announce
csiph-web