* functions/classes for walking data structures (__iter__/__next__ and yield)
properly evaluate if eq and flatten are needed as globals, or if they are better
placed into a class.
benefits of eq and flatten being globals is that they can accept lists
(or tuples, or anything supporting python Sequence pattern, including
generators and iterators).
like needed for creating similar object to one that already exists.
occurred to me that eq is equivalent to the pattern of the python operator
as such this would tend to suggest a name for a module where it could
from nmutil.operator import eq
this would form the pattern for additional "global" functions present
in Value (such as shape, implies and part).
flatten is... different, in that it is already in nmigen.tools, which
in turn assumes that the nmigen object is iterable (isinstance(x, Iterable)
and that in turn implies it should have an __iter__ (etc. etc.).
except, the version in nmigen.tools fails because Record doesn't have
patch for Record created (attached)
Created attachment 8 [details]
(In reply to Luke Kenneth Casson Leighton from comment #1)
> as such this would tend to suggest a name for a module where it could
> live: nmutil.operator.
> from nmutil.operator import eq
moved eq, shape and cat to nmoperator.py temporarily.
also the two visitor classes.