← Back to team overview

ufl team mailing list archive

Re: Strange bug

 

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 <logg@xxxxxxxxx>:
> 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
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (GNU/Linux)
>
> iD8DBQFI4hY6TuwUCDsYZdERAghxAJ43QOWCbwfBvI+ph/+rKhEnkWjb9gCcCmVN
> tP1Gf0ikF32JFdPqwLaGnEU=
> =v9Gt
> -----END PGP SIGNATURE-----
>
> _______________________________________________
> UFL-dev mailing list
> UFL-dev@xxxxxxxxxx
> http://fenics.org/mailman/listinfo/ufl-dev
>
>


Follow ups

References