Recent Commits to python-patterns:master

  • 22/09/2026 15:02

    Fix flyweight_with_metaclass sharing instances for different argument…

    Fix flyweight_with_metaclass sharing instances for different arguments (#495)
    
    The pool key concatenated str(arg) with no separator, so Card2('1', '0') and
    Card2('10') (or Card2(1) and Card2('1')) got the same key and the second call
    returned the first call's instance. Use repr of the class name, args and
    sorted kwargs instead, which also makes the key independent of kwarg order.
    Add tests, since the module had none.
    
    Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>

Log in