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

Getters and setters added as class attributes, not @property methods #74

Open
phoerious opened this issue Aug 29, 2024 · 1 comment
Open

Comments

@phoerious
Copy link

phoerious commented Aug 29, 2024

These pymethods

#[pymethods]
impl Foo {
    #[getter]
    pub fn readwrite(slf: PyRef<'_, Self>) -> String {
        String::new()
    }
    
    #[setter]
    pub fn set_readwrite<'py>(mut slf: PyRefMut<'py, Self>, data: &str) {}
  
    #[getter]
    pub fn readonly(slf: PyRef<'_, Self>) -> String {
        String::new()
    }
}

should translate to

class Foo:
    @property
    def readwrite(self) -> str: ...
  
    @readwrite.setter
    def readwrite(self, data: str): ...
  
    @property
    def readonly(self) -> str: ...

Instead, they translate to static class attributes without getter/setter logic.

@andrew-catalyst
Copy link

Also would mean you could generate docstrings for them, right now they don't seem to go anywhere.

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

2 participants