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

Feature: Use decorator within a class #1256

Open
diehlpk opened this issue Sep 24, 2020 · 2 comments
Open

Feature: Use decorator within a class #1256

diehlpk opened this issue Sep 24, 2020 · 2 comments
Labels
category: @Phylanx Everything related to the @Phylanx python decorator
Milestone

Comments

@diehlpk
Copy link
Member

diehlpk commented Sep 24, 2020

I was wondering if we can get this example to work in a near future

from phylanx import Phylanx


class test:
    
    n = 0
    
    @Phylanx
    def __init__(self,n):
        self.n = n
        
    @Phylanx
    def do(self,m):
        self.n += m 
    
    
if __name__ == "__main__":
    
    t = test(10)
    
    t.do(10) 

Or at least make some comment in the Readme that this is not supported yet

@hkaiser
Copy link
Member

hkaiser commented Sep 24, 2020

This is not supported (yet), as we don't support classes at all.

@hkaiser hkaiser added the category: @Phylanx Everything related to the @Phylanx python decorator label Sep 24, 2020
@hkaiser hkaiser added this to the 0.0.1 milestone Sep 24, 2020
@hkaiser
Copy link
Member

hkaiser commented Oct 12, 2020

We should implement this instead:

from phylanx import Phylanx

@Phylanx
class test:
    
    n = 0
    
    def __init__(self,n):
        self.n = n
        
    def do(self,m):
        self.n += m 

if __name__ == "__main__":
    t = test(10)
    t.do(10) 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: @Phylanx Everything related to the @Phylanx python decorator
Projects
None yet
Development

No branches or pull requests

2 participants