Some convenient utility functions added to helpers.py, which I had reason to make use of previously

This commit is contained in:
Sridhar Ramesh
2018-01-29 13:44:16 -08:00
parent 00ee9c3497
commit 9df8b0781e
2 changed files with 7 additions and 6 deletions

View File

@ -629,6 +629,12 @@ def angle_of_vector(vector):
return 0
return np.angle(complex(*vector[:2]))
def concatenate_lists(*list_of_lists):
return [item for l in list_of_lists for item in l]
# Occasionally convenient in order to write dict.x instead of more laborious
# (and less in keeping with all other attr accesses) dict["x"]
class DictAsObject(object):
def __init__(self, dict):
self.__dict__ = dict