Git Product home page Git Product logo

pyext's Introduction

PyExt

https://travis-ci.org/kirbyfan64/PyExt.png

Several simple extensions that add some nifty features to Python.

Links:

GitHub https://github.com/kirbyfan64/PyExt
PyPI https://pypi.python.org/pypi/pyext
Newsgroup https://groups.google.com/forum/#!forum/pyext

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...'
    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

Note

Please ignore this project's messy commit history(several commits under invalid_email_address, about 20 commits labeled Initial). I was trying to use hg-git and kept goofing stuff up.

pyext's People

Contributors

refi64 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

pyext's Issues

Officially release version 0.8

It seems v0.8 has been available here since 2015, but it was never tagged and uploaded to PyPi. It would be nice if that could be changed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.