Skip to content

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