<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>On Dec 9, 2015, at 03:43, טל ח <<a href="mailto:talh555@walla.co.il">talh555@walla.co.il</a>> wrote:</div><div><br></div><blockquote type="cite"><div><div dir="rtl">Hi,<br><br>I think it could be helpful for everyone if the function proposed by user "SomethingSomething" can be added as built-in</div></div></blockquote><blockquote type="cite"><div><div dir="rtl">in Python</div></div></blockquote><div><br></div>Why? When he was asked what use it might have, he didn't have an answer.<div><br></div><div>Also, notice that the answer he provided doesn't actually do what he asked for; as he himself points out, it's different in at least two ways from his stated requirements. So, which one of the two do you want? And why is that one, rather than the other, useful?</div><div><br></div><div>Also, why would you call this list_replace? That sounds like a function that would replace elements with elements, not make a copy with elements replaced by new lists flattened into place.</div><div><br></div><div>Also, why would you only want this lists, rather than for any iterable? And what can it do that this more general and completely trivial function can't:</div><div><br></div><div> def flattening_subst(iterable, value, sequence):</div><div> for x in iterable:</div><div> if x == value: yield from sequence</div><div> else: yield x</div><div><br></div><div>If you know of another language whose standard library has an equivalent, that might narrow down exactly what the requirements are, point at an implementation that actually meets those requirements, and probably provide examples that hint at the point of having this function in the first place.</div><div><div><div><br></div><br><blockquote type="cite"><div><div dir="rtl">See both question by "SomethingSomething" and answer to himself with implementation..<br><br><a href="http://stackoverflow.com/questions/34174643/python-find-replace-on-lists">http://stackoverflow.com/questions/34174643/python-find-replace-on-lists<br></a><br><br>Thanks</div></div></blockquote></div></div></body></html>