yield from () Was: Re: weirdness with list()

Alan Gauld alan.gauld at yahoo.co.uk
Sun Feb 28 18:47:04 EST 2021


On 28/02/2021 00:17, Cameron Simpson wrote:

> BUT... It also has a __iter__ value, which like any Box iterates over 
> the subboxes. For MDAT that is implemented like this:
> 
>     def __iter__(self):
>         yield from ()

Sorry, a bit OT but I'm curious. I haven't seen
this before:

yield from ()

What is it doing?
What do the () represent in this context?

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Python-list mailing list