Skip to content

ToSympyCode drops a lambda's body and throws on a set builder #985

Description

@Rafael-SOWNet

Two things MathS.ToSympyCode does with a binder, found while checking that the new forms in #976 export. Both are on master at 34f72d11 and neither is new — they reproduce with ordinary names.

1. A lambda exports with no body

MathS.ToSympyCode("lambda(x, x + 1)".ToEntity())
import sympy

x = sympy.Symbol('x')

expr = sympy.Lambda(x, )

sympy.Lambda(x, ) is a SyntaxError, so the generated file does not run. The body is simply not emitted.

2. A set builder throws

MathS.ToSympyCode("{ x : x > 0 }".ToEntity())
AngouriBugException: The given domain is not presented in those possible
 please report about it to the official repository

Reporting it, as instructed. A ConditionalSet reaches the exporter's domain switch with something the switch does not list; the natural export is sympy.ConditionalSet(x, x > 0, S.Complexes) or a Set comprehension.

Both are the export layer only — the entities themselves are fine, print correctly, and round-trip through the parser.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions