Skip to content

Commit 5381ecd

Browse files
committed
Add __slots__ for performance
1 parent 991a488 commit 5381ecd

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pif/providers.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ class ExistingSingleton[T](Provider):
2929
Provide an existing object instance.
3030
"""
3131

32+
__slots__ = ("t",)
33+
3234
def __init__(self, t: T):
3335
self.t = t
3436

@@ -44,6 +46,8 @@ class Singleton[T](Provider):
4446
Provide a singleton instance.
4547
"""
4648

49+
__slots__ = ("_func", "_args", "_kwargs", "_result", "_depends")
50+
4751
def __init__(self, func: Callable[[...], T], *args, **kwargs):
4852
self._func = func
4953
self._args = args

0 commit comments

Comments
 (0)