Commit b62c01ae7d135e2f2eafbbb6f0db07e519d8c584
1 parent
f8888f3d
Improve list generation in set_to_object()
Showing
1 changed file
with
2 additions
and
3 deletions
... | ... | @@ -418,8 +418,7 @@ def set_to_object(obj, path, value): |
418 | 418 | plusone = 1 if index >= 0 else 0 |
419 | 419 | if len(obj[key]) < abs(index) + plusone: |
420 | 420 | while not len(obj[key]) == abs(index) + plusone: |
421 | - extension = [None for _ in | |
422 | - range(abs(index) + plusone - len(obj[key]))] | |
421 | + extension = [None] * (abs(index) + plusone - len(obj[key])) | |
423 | 422 | if index < 0: |
424 | 423 | obj[key] = extension + obj[key] |
425 | 424 | else: |
... | ... | @@ -441,7 +440,7 @@ def set_to_object(obj, path, value): |
441 | 440 | return obj |
442 | 441 | |
443 | 442 | if not isinstance(path, STR_TYPES): |
444 | - raise TypeError('Path must be one of %s' % str(STR_TYPES)) | |
443 | + raise TypeError('Path must be one of ' + str(STR_TYPES)) | |
445 | 444 | return munchify(recur(obj, path, value)) |
446 | 445 | |
447 | 446 | ... | ... |
Please
register
or
login
to post a comment