def iter_segments(obj, neurite_filter=None, neurite_order=NeuriteIter.FileOrder):
sections = iter((obj,) if isinstance(obj, Section) else<EOL>iter_sections(obj,<EOL>neurite_filter=neurite_filter,<EOL>neurite_order=neurite_order))<EOL>return chain.from_iterable(zip(sec.points[:-<NUM_LIT:1>], sec.points[<NUM_LIT:1>:])<EOL>for sec in sections)<EOL>
Return an iterator to the segments in a collection of neurites

    Parameters:
        obj: neuron, population, neurite, section, or iterable containing neurite objects
        neurite_filter: optional top level filter on properties of neurite neurite objects
        neurite_order: order upon which neurite should be iterated. Values:
            - NeuriteIter.FileOrder: order of appearance in the file
            - NeuriteIter.NRN: NRN simulator order: soma -> axon -> basal -> apical

    Note:
        This is a convenience function provided for generic access to
        neuron segments. It may have a performance overhead WRT custom-made
        segment analysis functions that leverage numpy and section-wise iteration.