--- id: mixed-methods version: "1.1.1" license: MIT license_treatment: permissive maintenance: dormant --- # mixed-methods — Mixed methods. License: permissive · Maintenance: dormant · Downloads: 77.7K/mo ## What it is and what it does mixed-methods is a small utility library that exports a single decorator, `mixed_method`, which allows you to define a method that behaves as a classmethod when called on the class itself and as an instance method when called on an instance. You pass two functions to the decorator—one for class-level behavior and one for instance-level behavior—and the resulting method dispatches to the appropriate implementation based on how it's invoked. The package is typed and supports Python 3.8 and above. It has no external dependencies beyond attrs and typing-extensions, making it lightweight. The library is dormant (last updated over 900 days ago) but marked as production-stable; it solves a narrow, well-defined problem and has remained essentially unchanged since its early releases. Use it for: - Factory methods that construct instances differently when called on the class versus operating on an existing instance - Dual-mode utilities where class-level calls perform setup or configuration and instance calls perform operations - Avoiding name collisions when you need both a classmethod and instance method with identical names ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Provides a decorator that lets a single method behave differently when called on a class versus an instance, combining classmethod and instance method logic in one. Yes, if you specifically need a method that behaves as both classmethod and instance method. The package is lightweight, permissively licensed, and solves its narrow problem cleanly. However, dormant maintenance and minimal download volume suggest it remains a niche utility; only install if this exact pattern fits your design. ## Install pip install mixed-methods uv add mixed-methods poetry add mixed-methods ## Installing mixed-methods Before you install: Low friction install with only two lightweight runtime dependencies (attrs and typing-extensions). Maintenance is dormant—last release was over 900 days ago and the repository shows minimal activity, though it remains unarchived and marked production-stable. License in practice: MIT license is permissive; you can use, modify, and distribute this package freely with minimal restrictions. Quickstart: pip install mixed-methods from mixed_methods import mixed_method class Type: @classmethod def type_method(cls) -> int: return 13 def instance_method(self) -> int: return 42 method = mixed_method(type_method, instance_method) Type.method() # returns 13 instance = Type() instance.method() # returns 42 Requires Python 3.8 or above. Verify before relying: - Whether the package handles edge cases like inheritance, property interaction, or descriptor protocol conflicts - Performance characteristics when mixed methods are called in tight loops or hot code paths ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: dormant - Downloads: 77.7K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags mixed method decorator, classmethod instance method combined, dual behavior method python, class and instance method same name, polymorphic method decorator, decorator, method-dispatch [View on SkillFed](https://skillfed.io/packages/mixed-methods) · [View on PyPI](https://pypi.org/project/mixed-methods/)