Earlier quoted context omitted.
Let us know how we can improve! Feel free to start a discussion ( https://github.com/TimefoldAI/timefold-solver/discussions ) or submit an issue ( https://github.com/TimefoldAI/timefold-solver-python/issues ). We aim to treat Python as a first-class citizen (while keeping it maintainable). For instance, many of the Java methods are mapped to properties on the Python classes with more Pythonic names (see `ScoreExplana…
Langchain did something overloading the | or operator in their LCEL DSL to form LLM pipelines. It feels like abusing python but it's familiar enough as a Unix syntax
Does
constraint_factory.create_from_chain(
ForEach(Shift)
| Filter(lambda shift: shift.required_skill not in shift.employee.skills)
| Penalize(HardSoftScore.ONE_HARD)
| AsConstraint("Missing required skill")
)
Feel more Pythonic than (
constraint_factory.for_each(Shift)
.filter(lambda shift: shift.required_skill not in shift.employee.skills)
.penalize(HardSoftScore.ONE_HARD)
.as_constraint("Missing required skill")
)
?