Bug 297

Summary: nmutil "flatten" function already exists
Product: Libre-SOC's first SoC Reporter: Luke Kenneth Casson Leighton <lkcl>
Component: Source CodeAssignee: Luke Kenneth Casson Leighton <lkcl>
Status: CONFIRMED ---    
Severity: enhancement CC: libre-soc-bugs, programmerjake, whitequark
Priority: ---    
Version: unspecified   
Hardware: PC   
OS: Linux   
NLnet milestone: --- total budget (EUR) for completion of task and all subtasks: 0
budget (EUR) for this task, excluding subtasks' budget: 0 parent task for budget allocation:
child tasks for budget allocation: The table of payments (in EUR) for this task; TOML format:

Description Luke Kenneth Casson Leighton 2020-05-01 14:31:54 BST
nmigen already has a flatten function:
from nmigen._utils import flatten

whether we can rely on that staying there needs to be investigated
with whitequark
Comment 1 whitequark 2020-05-01 21:51:33 BST
Anything that starts with _ is a private function according to Python conventions and can be changed or removed without notice by nMigen.
Comment 2 Jacob Lifshay 2020-05-01 22:28:24 BST
(In reply to whitequark from comment #1)
> Anything that starts with _ is a private function according to Python
> conventions and can be changed or removed without notice by nMigen.

That's what I thought. Would you be open to changing `flatten` to a public API, or should we just keep using the duplicate in nmutil?
Comment 3 whitequark 2020-05-01 22:55:15 BST
> Would you be open to changing `flatten` to a public API

Why should it be a public API of nmigen? It's a general purpose utility function for iterables. It should be a public API of itertools, or another package like that.
Comment 4 Jacob Lifshay 2020-05-01 23:00:08 BST
(In reply to whitequark from comment #3)
> > Would you be open to changing `flatten` to a public API
> 
> Why should it be a public API of nmigen? It's a general purpose utility
> function for iterables. It should be a public API of itertools, or another
> package like that.

yeah, makes sense.

Luke, unless you want to pursue that option, I'll let you close this as won't-fix.
Comment 5 Luke Kenneth Casson Leighton 2020-05-02 00:04:36 BST
sigh.  it has to be a public function of a pacjsge... by us.  named nmutil.