mk wrote:
Hello everybody,
Any better solution than this?
def flatten(x):
res = []
for el in x:
if isinstance(el,list):
res.extend(flatten(el))
else:
res.append(el)
return res
a = [1, 2, 3, [4, 5, 6], [[7, 8], [9, 10]]]
print flatten(a)
It
[EMAIL PROTECTED] wrote:
So when you need an algorithm, you can often find it already inside,
for example in the large Combinatorics package. So it has WAY more
batteries included, compared to Python. I'd like to see something as
complete as that Combinatorics package in Python.
Sage (http
Xah Lee wrote:
alright, here's my improved code, pasted near the bottom.
let me say a few things about Jon's code.
If we rate that piece of mathematica code on the level of: Beginner
Mathematica programer, Intermediate, Advanced, where Beginner is
someone who just learned tried to program Mathe
Hi all,
I just started using the warnings module in Python 2.5.2. When I
trigger a warning using the default warning options, an entry is created
in a module-level cache so that the warning is ignored in the future.
However, I don't see an easy way to clear or invalidate these
module-level