brainpy / BrainPy

Brain Dynamics Programming in Python
https://brainpy.readthedocs.io/
GNU General Public License v3.0
491 stars 90 forks source link

Deprecated collections type #676

Closed KafCoppelia closed 3 weeks ago

KafCoppelia commented 3 weeks ago

collections.Iterable this usage is deprecated in py3.10 and later, use collections.abc.Iterable instead.

import brainpy as bp
hh = bp.neurons.HH((10, 20), keep_size=True)
hh2 = hh[None, 1:]

If the wrong slice is passed in, an exception will be raised from the DynView module in py3.11.

.../brainpy/_src/dynsys.py", line 809, in __init__
    if not isinstance(idx, collections.Iterable):
                           ^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'collections' has no attribute 'Iterable'
chaoming0625 commented 3 weeks ago

Thanks for the report. While, we do not recommend to use hh[None, 1:]. This function may encounter strange bugs.