GithubHelp home page GithubHelp logo

eackermann / snarky Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 11 KB

Snarky is a useless Python package that makes it easy to add a jk (just kidding!) keyword argument to any function.

License: Other

Python 100.00%
useless python lol

snarky's Introduction

Snarky

Snarky is a useless Python package that makes it easy to add a jk (just kidding!) keyword argument to any function. Moreover, snarky defines several default behaviors for reacting whenever jk==True.

Quick examples

Using snarky is really easy. Suppose we have a function:

def my_func(a, b):
    """Sample function with arguments."""
    return a*b

Then calling our function might look like this:

>>> my_func(4, 5)
20

>>> my_func(a=3, b=7)
21

>>> my_func(a=3, b=7, jk=True)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-143-231ea24720af> in <module>()
----> 1 my_func(a=3, b=7, jk=True)

TypeError: my_func() got an unexpected keyword argument 'jk'

But that's lame! What function doesn't give you the option to say 'just kidding!', right?

That's where snarky shines!

Simply add one of several default behaviors, or even define your own! Here, we will apply the default snarky behavior to our function:

from snarky import *

@snarky
def my_func(a, b):
    """Sample function with arguments."""
    return a*b

Now calling our function might look like this:

>>> my_func(4, 5)
20

>>> my_func(a=3, b=7)
21

>>> my_func(a=3, b=7, jk=True)
LOL! Then why are you asking me to run 'my_func'? Unbelievable!
21

And the day is saved.

Installation

The easiest way to install snarky is to use pip. From the terminal, run:

$ pip install snarky

Alternatively, you can install the latest version of snarky by running the following commands:

$ git clone https://github.com/eackermann/snarky.git
$ cd snarky
$ python setup.py install

License

Snarky is distributed under the MIT license. See the LICENSE file for details.

snarky's People

Contributors

eackermann avatar

Watchers

James Cloos avatar  avatar

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.