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

having ic() output class name #120

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

Loriasun
Copy link

ic() output class name

Modified parentFunction in _getContext so that icecream prints class name for the method as well.

@salabim
Copy link

salabim commented Apr 12, 2022

With the pull request, this program

from icecream import ic
ic.configureOutput(includeContext=True)

def a():
    def hello(val):
        ic(val)
    hello("world")
a()

results in

ic| test context icecream.py:6 in a.<locals>.hello()- val: 'world'

Therefore, I think it would be better to use

        parentFunction = executing.Source.executing(callFrame).code_qualname().replace(".<locals>.",".")

@Loriasun
Copy link
Author

@salabim Thank you for your suggestion!

@alexmojaki
Copy link
Collaborator

I agree with @salabim's suggestion, I think a.hello is better than a.<locals>.hello for this purpose.

@Loriasun did you run the tests with this PR? I suspect many of them now fail and need updating.

We really need to have functioning CI again. I don't think #98 is going to happen, so it would be really helpful to set up GitHub actions to replace Travis.

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.

3 participants