Skip to content

Latest commit

 

History

History
47 lines (29 loc) · 1.04 KB

README.md

File metadata and controls

47 lines (29 loc) · 1.04 KB

invars

This package brings invariable variables or single assignment variables to Python (like in Erlang and other functional programming languages).

Examples

one = 1
two = 2
...
two += one  # invalid!
total = 0
for i in range(4):
    total += i  # invalid!

Installation

$ pip install invars

Usage

$ invars my_script.py

Why?

In functional programming, assignment is discouraged in favor of single assignment. [...] Imperative assignment can introduce side effects while destroying and making the old value unavailable while substituting it with a new one

Wikipedia

Single assignment variables simplifies a lot of things because it takes out the "time" variable from your programs.

Stack Overflow

TODO

  • Integrate with flakes8