Subject: [UFL-dev] Strange bug

From: Anders Logg <[email-masked]>
Date: Tue, 30 Sep 2008 14:06:19 +0200

I've implemented is_multilinear and it seems to work fine, but there
is a mysterious bug. Try running multilinear.py in the sandbox. The
first two forms are not multilinear, but the third one is.

If I iterate over the tree like this, it works:

    for (o, stack) in traversal(e, []):

But if I do like this, it does not:

    for (o, stack) in traversal(e):

The default argument for stack is [] so it shouldn't be any
difference, but without adding [], is_multilinear reports that the
third from (c) is not multilinear because of a division by a basis
function which appears in (b). So for some reason, an operator from
the previous form remains in the stack.

Any ideas?

-- 
Anders

---

From: "Martin Sandve Alnæs" <[email-masked]>
Date: Tue, 30 Sep 2008 14:10:08 +0200

Always use "None" for default arguments like this, since Python keeps
the default argument object somehow. This is a bit weird, so I tend to
use "None" for default arguments more than needed just to be on the
safe side :-/

-- 
Martin

2008/9/30 Anders Logg <[email-masked]>:
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (GNU/Linux)
>
> iD8DBQFI4hY6TuwUCDsYZdERAghxAJ43QOWCbwfBvI+ph/+rKhEnkWjb9gCcCmVN
> tP1Gf0ikF32JFdPqwLaGnEU=
> =v9Gt
> -----END PGP SIGNATURE-----
>
> _______________________________________________
> UFL-dev mailing list
> [email-masked]
> http://fenics.org/mailman/listinfo/ufl-dev
>
>

---

From: Anders Logg <[email-masked]>
Date: Tue, 30 Sep 2008 14:39:16 +0200

> use "None" for default arguments more than needed just to be on the

ok! I didn't know that. Strange...

-- 
Anders