Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal: make all PyX.create functions behave like equivalent Python constructor #94

Open
gatesn opened this issue Sep 14, 2023 · 0 comments

Comments

@gatesn
Copy link
Contributor

gatesn commented Sep 14, 2023

Currently a PyTuple.create only supports converting from a Zig tuple struct.

When wrapping/unwrapping, it's the trampoline that decides which type a value should be converted into. In some cases, e.g. for call arguments, we know we want an args tuple and kwargs dict. It is then ambiguous whether an empty Zig struct should be converted to a PyTuple or PyDict.

Similarly, we would never convert anything into a PySet. And there is an ambiguity in how to handle []u8 as PyString or PyBytes.

The proposal suggests the trampoline has a default target for each type, but all types can be explicitly constructed from any compatible object using their create function (possibly rename to new?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant