Skip to content

Commit aaf25c9

Browse files
committed
Rapple iteratively to tuples and ranges
1 parent 6b29de8 commit aaf25c9

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

labthings/core/utilities.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,12 @@ def rapply(data, func, *args, apply_to_iterables=True, **kwargs):
9999
)
100100
for key, val in data.items()
101101
}
102-
# If the object is iterable but NOT a dictionary or a string
103-
elif apply_to_iterables and (isinstance(data, typing.List)):
102+
# If the object is a list, tuple, or range
103+
elif apply_to_iterables and (
104+
isinstance(data, typing.List)
105+
or isinstance(data, typing.Tuple)
106+
or isinstance(data, range)
107+
):
104108
return [
105109
rapply(x, func, *args, apply_to_iterables=apply_to_iterables, **kwargs)
106110
for x in data

0 commit comments

Comments
 (0)