Skip to content

Instantly share code, notes, and snippets.

@kos59125
Last active February 28, 2018 12:02
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 kos59125/9bd657f343d060429d10a753b33db695 to your computer and use it in GitHub Desktop.
Save kos59125/9bd657f343d060429d10a753b33db695 to your computer and use it in GitHub Desktop.
emurate c function in R
def c(*args):
l = []
for x in args:
if hasattr(x, '__iter__'):
l.extend(list(x))
else:
l.append(x)
return l
# [0, 1, 2, 3, 4, 9, 14, 15, 16, 17]
print(c(range(0, 5), 9, range(14, 18)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment