You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Let's suppose we call the decorator with func and 'Mary'.
decorator(func, 'Mary')
In decorator, the returned value from wraps(*args, **kwargs) is the variable name from func. Is there a way for Rust to track the variable name and always be able to return the value referred to by name, e.g. 'Mary'?
name -> value: 'Mary'
Suppose somewhere down the line, a code like this is executed: decorator(func, 'Jane'), I would want the wrapped struct in Rust to be able to know name referred to value has changed to 'Jane'. How can I achieve this?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Suppose I have a decorator that gets a returned variable from the wrapped function, how do I 'track' that variable using Rust pyo3?
Example
Let's suppose we call the
decorator
withfunc
and'Mary'
.In
decorator
, the returned value fromwraps(*args, **kwargs)
is the variablename
fromfunc
. Is there a way for Rust to track the variablename
and always be able to return the value referred to byname
, e.g.'Mary'
?name
-> value:'Mary'
Suppose somewhere down the line, a code like this is executed:
decorator(func, 'Jane')
, I would want the wrapped struct in Rust to be able to knowname
referred to value has changed to'Jane'
. How can I achieve this?Beta Was this translation helpful? Give feedback.
All reactions