py-ast - v1.16.0
    Preparing search index...

    Class PyComplex

    A Python complex value, produced by parsing an imaginary literal (e.g. 4j, 3.5j). Python's grammar only ever produces a literal for the pure-imaginary case, so real is 0 for any value the parser constructs; real is still exposed so the class can represent a full complex value (e.g. one built up via evaluateLiteral from 3 + 4j), mirroring CPython's complex type.

    Index
    real: number
    imag: number
    • Renders the value the way CPython's repr()/ast.unparse would, e.g. 4j, -4j, (3+4j), or (-0+4j). Negative zero is distinguished from positive zero (as CPython's repr does) since JavaScript's default number-to-string conversion collapses -0 to "0", silently losing the sign that a real part of exactly -0.0 (e.g. from -0.0+4j) or an imaginary part of -0.0 (e.g. from 3-0j) needs to round-trip.

      Returns string