Skip to content

Instantly share code, notes, and snippets.

@chrisvoncsefalvay
Created February 8, 2017 22:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrisvoncsefalvay/0d721e9c666f9a787ea128906e0bab36 to your computer and use it in GitHub Desktop.
Save chrisvoncsefalvay/0d721e9c666f9a787ea128906e0bab36 to your computer and use it in GitHub Desktop.
All sorts of useful Python hacks...
def humanized_join_list(item_list: Union[List, Tuple], ordinary_separator: str = ", ", final_separator=" and "):
return final_separator.join([ordinary_separator.join(item_list[:-1]), item_list[-1]] if len(item_list) > 2 else
item_list)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment