From 4f078df61229766a924c7f6bbb35838e6b6de37e Mon Sep 17 00:00:00 2001 From: Tyrel Souza Date: Thu, 30 Oct 2014 13:49:31 -0400 Subject: [PATCH] support named args --- README.md | 3 +++ glue.py | 7 ++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 23e66fd..c0b1f09 100644 --- a/README.md +++ b/README.md @@ -4,4 +4,7 @@ How to use Glue >>> from glue import glue >>> print glue("any","number","of","things","together") any number of things together + +>>> print glue("any","number","of","things","together",where="anywhere") +any number of things together anywhere ``` diff --git a/glue.py b/glue.py index a4d8949..afe5602 100644 --- a/glue.py +++ b/glue.py @@ -1,3 +1,4 @@ -__author__ == "Tyrel Souza " -def glue(*args): - return " ".join((args)) +def glue(*args, **kwargs): + what_to_glue = list(args) + what_to_glue.extend([v for k,v in kwargs.iteritems()]) + return " ".join(what_to_glue)