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

0.12.2 #103

Merged
merged 6 commits into from
Nov 29, 2023
Merged

0.12.2 #103

merged 6 commits into from
Nov 29, 2023

Conversation

pwwang
Copy link
Owner

@pwwang pwwang commented Nov 29, 2023

  • Add helpers.exec_code function to replace exec so that source code is available at runtime
from varname import argname
from varname.helpers import exec_code


class Obj:
    def __init__(self):
        self.argnames = []

    def receive(self, arg):
        self.argnames.append(argname('arg', func=self.receive))


obj = Obj()
# exec('obj.receive(1)')  # Error
exec_code('obj.receive(1)')
exec_code('obj.receive(2)')
print(obj.argnames)  # ['1', '2']

Copy link

codesandbox bot commented Nov 29, 2023

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

@pwwang pwwang merged commit be560cc into master Nov 29, 2023
13 checks passed
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

Successfully merging this pull request may close these issues.

1 participant