Skip to content

Commit

Permalink
Shorter Shape repr when using item names
Browse files Browse the repository at this point in the history
  • Loading branch information
Philipp Holl committed Nov 27, 2024
1 parent 38a3507 commit d243086
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion phiml/math/_shape.py
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ def __repr__(self):
def size_repr(size, items):
if items is not None:
items_str = ",".join(items)
return items_str if len(items_str) <= 20 else f"{size}:{items[0]}..{items[-1]}"
return items_str if len(items_str) <= 12 else f"{size}:{items[0][:5]}..."
return size

strings = [f"{name}{SUPERSCRIPT.get(dim_type, '?')}={size_repr(size, items)}" for size, name, dim_type, items in self._dimensions]
Expand Down

0 comments on commit d243086

Please sign in to comment.