Skip to content

Commit

Permalink
rebase / tweak repr construction
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-beedie committed Mar 20, 2024
1 parent 7b3241e commit fc48302
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions py-polars/polars/datatypes/classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -628,14 +628,14 @@ def __hash__(self) -> int:
def __repr__(self) -> str:
class_name = self.__class__.__name__
if len(categories := self.categories) <= 6:
categories = [",".join(f"{cat!r}" for cat in categories)]
category_repr = ",".join(f"{cat!r}" for cat in categories)
else:
categories = (
[",".join(f"{cat!r}" for cat in categories[:3])]
+ ["…"]
+ [",".join(f"{cat!r}" for cat in categories[-3:])]
category_repr = (
",".join(f"{cat!r}" for cat in categories[:3])
+ " … "
+ ",".join(f"{cat!r}" for cat in categories[-3:])
)
return f"{class_name}(categories=[{' '.join(categories)}])"
return f"{class_name}(categories=[{category_repr}])"


class Object(DataType):
Expand Down

0 comments on commit fc48302

Please sign in to comment.