Skip to content

Instantly share code, notes, and snippets.

@adoc
Last active August 29, 2015 13:59
Show Gist options
  • Save adoc/10487972 to your computer and use it in GitHub Desktop.
Save adoc/10487972 to your computer and use it in GitHub Desktop.
def qbytes(*args):
"""Accepts argument list of variables that might be bytes and
decodes, otherwise passing the value through."""
# This is a bit hackish and the static-typers are throwing their
# hands up. :P
return tuple([arg.decode()
if isinstance(arg, bytes)
else arg
for arg in args])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment