CiwPython / Ciw

Ciw is a simulation library for open queueing networks.
http://ciw.readthedocs.io
MIT License
148 stars 42 forks source link

customer_class is hashable #223

Closed galenseilis closed 3 months ago

galenseilis commented 10 months ago

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.

geraintpalmer commented 6 months ago

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.