icecream icon indicating copy to clipboard operation
icecream copied to clipboard

having ic() output class name

Open Loriasun opened this issue 2 years ago • 3 comments

ic() output class name

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

Loriasun avatar Apr 11 '22 20:04 Loriasun

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>.",".")

salabim avatar Apr 12 '22 08:04 salabim

@salabim Thank you for your suggestion!

Loriasun avatar Apr 13 '22 01:04 Loriasun

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.

alexmojaki avatar Apr 13 '22 11:04 alexmojaki