If you restrict the idea to 'if' and 'while', Why not render this using the
existing 'as' form for binding names, already used with 'except' and 'with':
while learner.get(static_hint) as points:
learner.feed(f(points))
The equivalent for 'if' helps with the regex matching case:
i
e existence of
>>>> dec_mpd_isinteger() seems to validate to me that it actually exposes useful
>>>> functionality (and every Python feature can be abused, so that alone should
>>>> not
>>>>
>>> )
>>
> ___
argument that a putative complex.is_integral() should
therefore return False, but I expect that would get even less support than
the other suggestions in these threads.
*Robert Smallshire | *Managing Director
*Sixty North* | Applications | Consulting | Training
r...@sixty-north.com | T +47 63 01 04 44 | M +47
Here's an excerpted (and slightly simplified for consumption here) usage of
float.is_integer() from the top of a function which does some
convolution/filtering in a geophysics application. I've mostly seen it used
in guard clauses in this way to reject either illegal numeric arguments
directly, or
As requested on the bug tracker, I've submitted a pull request for
is_integer() support on the other numeric types.
https://github.com/python/cpython/pull/6121
These are the tactics I used to implement it:
- float: is_integer() already exists, so no changes
- int: return True
- Real: return x