feat: add length property to Selectors to write less code

This commit is contained in:
Karim shoair
2025-07-29 06:19:45 +03:00
parent 29b77a96c8
commit 715dfb4243
+5
View File
@@ -1377,6 +1377,11 @@ class Selectors(List[Selector]):
"""Returns the last item of the current list or `None` if the list is empty"""
return self[-1] if len(self) > 0 else None
@property
def length(self):
"""Returns the length of the current list"""
return len(self)
def __getstate__(self) -> Any:
# lxml don't like it :)
raise TypeError("Can't pickle Selectors object")