Changes between Version 1 and Version 2 of Ticket #34435, comment 6


Ignore:
Timestamp:
Apr 17, 2023, 4:53:50 AM (17 months ago)
Author:
Tobias Krönke

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #34435, comment 6

    v1 v2  
    22> Can you suggest what changes should be done?
    33
    4 That's a good question, because python offers no simple check a la `ismutable(x)`. It would be easy to just do a check like `isinstance(x, (bool, int, float, tuple, str, frozenset, decimal, complex, bytes))`, if you can live with the "danger" of users sub-classing those types and making them mutable. But I guess those can't be helped with this check.
     4That's a good question, because python offers no simple check a la `ismutable(x)`. It would be easy to just do an additional check like `isinstance(x, (bool, int, float, tuple, str, frozenset, decimal, complex, bytes))`, if you can live with the "danger" of users sub-classing those types and making them mutable. But I guess those can't be helped with this check.
Back to Top