Simple Python extensions.
Project Links
Meta
Author: Ryan Gonzalez
Classifiers
License
- OSI Approved :: MIT License
Programming Language
- Python :: 2
- Python :: 3
Several simple extensions that add some nifty features to Python.
Links:
GitHub |
|
PyPI |
|
Newsgroup |
Features:
Function overloading
Switch statement
Runtime module creation
Tail recursion removal
Python 2 function annotations
Python 2 safe tuple unpacking
Assignment if condition is true
Examples:
Function overloading:
@overload.argc(1) def f(a): print 'Function 1 called' @overload.argc(2) def f(a, b): print 'Function 2 called' f(1) f(1, 2)
Switch statement:
with switch(1):
if case(0): print 'Awkward...'; case.quit() # case.quit() is the same as break
if case(2): print '???'
if case(1): print 'Phew! It works!'
if case.default(): print 'Ummmm...'
Function annotations:
@fannotate('Return annotation', a=1, b=2)
def x(a, b):
return 0
Assign if condition is true:
compare_and_swap('my_var', None, 2) # set my_var to 2 if it equals None
0.7
May 27, 2014
0.6
Feb 09, 2014
0.5.1
Jan 30, 2014
0.5
Jan 29, 2014
0.4
Jan 19, 2014
0.3.1
Dec 13, 2013
0.3
Dec 13, 2013
0.2
Nov 24, 2013
0.1
Nov 21, 2013
Files in release
No dependencies