Created
April 19, 2014 20:03
-
-
Save tomthorogood/11095793 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def reverse(string): | |
return string[::-1] | |
def concat(*strings): | |
return "".join(strings) | |
def create_factory(obj, *args, **kwargs): | |
def factory(*oargs, **okwargs): | |
return obj(*oargs, **okwargs) | |
def default_args_factory(*oargs, **okwargs): | |
args.extend(oargs) | |
kwargs = dict(kwargs.items() + okwargs.items()) | |
return obj(*args, **kwargs) | |
if not args and not kwargs: | |
return factory | |
elif args or kwargs: | |
return default_args_factory |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment