support named args

This commit is contained in:
Tyrel Souza 2014-10-30 13:49:31 -04:00
parent 64fc2593aa
commit 4f078df612
2 changed files with 7 additions and 3 deletions

View File

@ -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
```

View File

@ -1,3 +1,4 @@
__author__ == "Tyrel Souza <tyrelsouza@gmail.com>"
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)