Op 20/06/2023 om 2:50 schreef Greg Ewing via Python-list:
I would question the wisdom of designing an API that
can return either a sequence or None. If it normally
returns a sequence, and there are no items to return,
it should return an empty sequence.
I guess it depends on the reason why there are no items. If it is simply
because there are no items, then yes, I agree it should return an empty
sequence. But if it is because of some kind of error condition, I don't
think it should. But in that case I don't think the API should return
None either: I feel it should raise an exception.
--
"Je ne suis pas d’accord avec ce que vous dites, mais je me battrai jusqu’à
la mort pour que vous ayez le droit de le dire."
-- Attribué à Voltaire
"I disapprove of what you say, but I will defend to the death your right to
say it."
-- Attributed to Voltaire
"Ik ben het niet eens met wat je zegt, maar ik zal je recht om het te zeggen
tot de dood toe verdedigen"
-- Toegeschreven aan Voltaire
--
https://mail.python.org/mailman/listinfo/python-list