Skip to content

Instantly share code, notes, and snippets.

View PythonCHB's full-sized avatar

Christopher H.Barker, PhD PythonCHB

View GitHub Profile
@PythonCHB
PythonCHB / islice.py
Created May 31, 2018 05:44
slice iterator
#!/usr/bin/env python3
"""
islice mixin -- makes an easy to access slice-style iterator
"""
class slice_list(list):
@PythonCHB
PythonCHB / is_close.py
Last active August 29, 2015 14:13
Sample implementation of an "closeness" checker for floating point for Python
#!/usr/bin/env python3
"""
A proposed implementation for an "is_close" implementation for floating point
(and complex) numbers for python.
This is an attempt to implement the approach used by Boost:
http://www.boost.org/doc/libs/1_34_0/libs/test/doc/components/test_tools/floating_point_comparison.html