Add Support for Transforming Pythonic Values #109

Open
opened 2026-03-31 20:08:55 +00:00 by hz · 0 comments
Owner

Given that we've reverted the code in pythonic to use ast.literal_eval, it would be nice to have a way to specify a transformation of the given variable to turn it into an appropriate literal value. For example, if the expected answer is a numpy array, we could have a function that takes that array and calls .tolist on it. I'm not sure the best way to specify this, maybe a function with a special name in csq_code_pre, and then in the sandbox, if that function exists, we call it to get the final return value.

Given that we've reverted the code in `pythonic` to use `ast.literal_eval`, it would be nice to have a way to specify a transformation of the given variable to turn it into an appropriate literal value. For example, if the expected answer is a `numpy` array, we could have a function that takes that array and calls `.tolist` on it. I'm not sure the best way to specify this, maybe a function with a special name in `csq_code_pre`, and then in the sandbox, if that function exists, we call it to get the final return value.
hz added this to the v20.0.0 milestone 2026-03-31 20:08:55 +00:00
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
catsoop/catsoop#109
No description provided.