commit:     241f7cc7771308d0f03a5b2dfa48c48df65b53ee
Author:     Brian Harring <ferringb <AT> gmail <DOT> com>
AuthorDate: Sun Dec 14 17:13:27 2025 +0000
Commit:     Brian Harring <ferringb <AT> gmail <DOT> com>
CommitDate: Mon Dec 15 12:42:10 2025 +0000
URL:        
https://gitweb.gentoo.org/proj/pkgcore/snakeoil.git/commit/?id=241f7cc7

tweak get_attrs_of to explain the issue with vars()

Signed-off-by: Brian Harring <ferringb <AT> gmail.com>

 src/snakeoil/klass/util.py | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/snakeoil/klass/util.py b/src/snakeoil/klass/util.py
index b92950b..3a85f32 100644
--- a/src/snakeoil/klass/util.py
+++ b/src/snakeoil/klass/util.py
@@ -56,11 +56,10 @@ def get_attrs_of(
     _sentinel=object(),
 ) -> typing.Iterable[tuple[str, typing.Any]]:
     """
-    yield the attributes of a given instance.
+    A version of `vars()` that actually returns slotted attributes.  Use this 
instead of `vars()`.
 
-    This handles both slotted and non slotted classes- slotted
-    classes do not have __dict__.  It also handles mixed derivations,
-    a non slotted class that inherited from a slotted class.
+    This handles both slotted and non slotted classes.  `vars()` only returns 
what is in `__dict__`,
+    it will *not* return any slotted attributed.  This will return both.
 
     For an ordered __dict__ class, the ordering is *not* honored in what
     this yields.

Reply via email to