Ciw icon indicating copy to clipboard operation
Ciw copied to clipboard

customer_class is hashable

Open galenseilis opened this issue 2 years ago • 1 comments

Because customer_class merely needs to be hashable and ordered, and there is no currently-supported typing for being ordered in Python, setting it to hashable seems like the closest typing to use for the current state.

I have actually been using dataclasses with @dataclass(order=True, frozen=True) so that I can keep track of a variety of types of data that distinguish classes of patients based on their attributes. But I wouldn't want to make defining dataclasses a requirement.

galenseilis avatar Dec 03 '23 20:12 galenseilis

I'm not sure I agree with this change. Even though the logic of Ciw allows for customer class name that are not strings, as customer class names appear in the list of data records. It is usual to use pandas to analyse the records, and strings work well with pandas Data Frames. Similarly, I am not sure collections.abc.Hashable is as well known and accessible as strings. E.g., this library is used by no-specialist Python users and in education, and simplifying to strings is a feature.

geraintpalmer avatar Apr 03 '24 09:04 geraintpalmer