great-tables icon indicating copy to clipboard operation
great-tables copied to clipboard

Consolidate ordered list code using new `_create_ordered_list()` function

Open jrycw opened this issue 6 months ago • 2 comments

Hello team,

I would like to propose consolidating the ordered list-related code using a new function, _create_ordered_list().

Our current logic works well, such as list({k: True for k in x}) in the _unique_set() function. However, even after working on the project for a while, I find it confusing to understand why the True is needed. It makes me question whether we need this Boolean value for some if-else logic. Eventually, I realize it's just a placeholder—a nice trick but not very intuitive.

A few hours ago, I came across a post from Michael Driscoll on LinkedIn and found that list(dict.fromkeys(x).keys()) is more readable and neat, with a functional programming style. What do you think about this modification?

jrycw avatar Jul 27 '24 02:07 jrycw