Why have .text_lexbor (publicly available) if it's equivalent to .text() with default parameters ?
Closed this issue · 3 comments
.text_lexbor()
seems to do really exactly the same thing than .text()
with default parameters. So why keeping it ?
If it's more performant than .text()
, why not check when .text()
is launched with default parameters and internally use .text_lexbor()
when it's the case ? (To make .text()
as performant than .text_lexbor()
and turn .text_lexbor()
into a private function.)
According to documentation, there is no difference. It just precise that .text_lexbor()
"uses builtin method from lexbor". Having duplicates (without explanation of utility) introduce a bit of confusion.
Little code showing equivalence :
tree = LexborHTMLParser(offline_wiki_page)
text = tree.body.text()
text_lexbor = tree.body.text_lexbor()
if (text == text_lexbor):
print ("text and text_lexbor are equivalent.")
else:
print ("text and text_lexbor are different.")
It does not support a custom separator, so we can't reuse it everywhere.
Sometimes, you want to have a custom separator due to how text is styled with CSS.
It does not support a custom separator, so we can't reuse it everywhere. Sometimes, you want to have a custom separator due to how text is styled with CSS.
I am not asking for what is the point of .text()
(which have multiple options like custom separator), I'm asking for what is the point of .text_lexbor()
(which doesn't have options according to the documentation)
My question is about the point of having .text_lexbor()
publicly available.
My question is about the point of having .text_lexbor() publicly available.
Just to give people more options. At the end of the day it's a wrapper and it exposes some of the internals.