On Mon, Jan 29, 2018 at 3:26 PM, Rowan Collins <rowan.coll...@gmail.com> wrote:
> On 29 January 2018 19:14:43 GMT+00:00, Michael Morris <tendo...@gmail.com> > wrote: > > The is_callable() > >above prevents iteration over generators, potentially consuming them > >for no purpose. > > Unfortunately, it doesn't: it's not the generator definition that you'll > be passed, but the Generator object returned when you run it, and that is > not callable https://3v4l.org/rknQJ > > (The definition is more like a constructor, and I wish it didn't look so > much like a normal function in declaration and use.) > > Nor are generators the only non-rewindable iterables you need to worry > about, so really the only options you have are to only inspect arrays, or > to add a big fat warning that the function may consume your iterable (or > enter an infinite loop). > > Ok, so make no attempt to keep people from shooting themselves in the foot eh? Fine, is this otherwise workable?