On 19.06.2021 17:17, Serhiy Storchaka wrote:
19.06.21 18:12, Marc-Andre Lemburg пише:
But there could be endless debate about whether flatten( ("x", "y") ) should return a list or a tuple...
Have it return an iterator :-)
flatten = itertools.chain.from_iterable
Well, like I said: modulo the discussion around what "flatten" should mean, e.g. you will probably want to have flatten() go a certain number of levels deep and not necessarily flatten strings. But yes, such a definition is certainly a good start. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Experts (#1, Jun 19 2021)
Python Projects, Coaching and Support ... https://www.egenix.com/ Python Product Development ... https://consulting.egenix.com/
::: We implement business ideas - efficiently in both time and costs ::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 https://www.egenix.com/company/contact/ https://www.malemburg.com/