argument types in class definitions
- Dominant language
- Julia
- Stars
- 1.5k
- Forks
- 186
- PR merge metrics
- No merged PRs in 30d
Description
It would be nice to be able to specify argument types for methods when defining a Python class via `@pydef`. That is
```jl
@pydef type Foo
bar(self, x::T) = baz(x)
end
```
would turn into `PyObject(baz(convert(T, x)))` given the raw `x::PyObject`. The default `T` would be `PyAny`, as now.
This is especially useful to *suppress* the auto-conversion, via `bar(self, x::PyObject)`. For example, in the `IO` conversion I noticed that we aren't implementing `readinto` correctly: to read in-place, we will have to get the raw `PyObject` and use `PyBuffer` to wrap an `Array{UInt8}` around it.
cc @cstjean
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.