Hi,

is there a standard way in the compiler to know (or to find out) that an
expression is constant? I noticed the "analyse_const_expression()" methods,
but they are only meant to calculate "DEF" expressions, so they raise an error
if the expression is not constant.

I'm thinking about code like this:

    raise ValueError("constant")

that always raises a constant tuple with one string element that is stored in
a global constant at module init time. It would be better to store the tuple
here, not only the string. But that would require knowing that the whole tuple
is constant.

Maybe we should split "check_const()" into one part that checks the expression
and another that raises the error (if required). Or maybe pass a flag.

Stefan
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to