Cope 2.5.0
My personal "standard library" of all the generally useful code I've written for various projects over the years
Loading...
Searching...
No Matches

◆ ensure_not_iterable()

def Cope.misc.ensure_not_iterable ( Iterable  iter)

Ensures that iter is not an iterable, IF iter only has one element.

If iter has 0 or more than 1 elements, it returns iter unchanged. This function works with generators, but they must self-terminate. DO NOT PASS INFINITE ITERATORS TO THIS FUNCTION. There is no good way to test for them, and they will cause an infinite loop

Definition at line 212 of file misc.py.