I have a PR open for this issue, and I was wondering what the best way to move forward with it is?
The issue is that findtext
’s implementation returns back elem.text or ""
which means that any “falsey” values (like 0) would give back an empty string. The documentation states that: “Note that if the matching element has no text content an empty string is returned”.
It seems the intent here would be that only if elem.text
is None
should it give back an empty string since I would assume that is closer to how “no text content” would be interpreted, and I don’t think 0 or an empty list would typically be interpreted as “no text content”.
The main concern on the PR is that this behavior has been like this for a long time so there is a hesitation to “fixing” it since it could break someone’s code if they are for whatever reason relying on this behavior.
Do we want to put in a fix for that behavior or treat this as purely a documentation issue and simply clarify this behavior? Also, please let me know if there is a better avenue for this sort of question. I tried the core-mentorship mailing list, but I got an automated reply (a couple weeks ago now) that the message is pending approval.