pub fn condition_to_rust(
expr: &ExprType,
ctx: CodeGenContext,
options: PythonOptions,
symbols: SymbolTableScopes,
) -> Result<TokenStream, Box<dyn Error>>Expand description
Lower an expression in condition position (if/while/ternary/assert
tests): Python implicitly calls bool() on it. Boolean operators recurse
into their operands and not negates a condition; comparisons already
yield bool; anything else is wrapped in stdpython’s Truthy::is_truthy,
giving Python’s truth table (empty string/collection and zero are
false).