Should NoneType be iterable?

Barry barry at barrys-emacs.org
Tue Jun 20 03:36:36 EDT 2023



> On 20 Jun 2023, at 01:57, Greg Ewing via Python-list <python-list at python.org> wrote:
> 
> I would question the wisdom of designing an API that
> can return either a sequence or None.

I have some APIs that do return None or a list.
The None says that a list is not available and that the caller is
responsible with dealing in a application-domain specific with
with that situation.

In other cases I have API that returns a default list, often [].

It all depends on the design needs.

Barry





More information about the Python-list mailing list