ryananguiano / async_property

Python decorator for async properties.
MIT License
82 stars 8 forks source link

TypeError in iPython #3

Open tehfink opened 4 years ago

tehfink commented 4 years ago

Description

Trying to test the output of a cached attribute from the code example results in a TypeError in the iPython interpreter.

What I Did

In [53]: type(instance.value)                                                                                                                                       
Out[53]: ---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
~/Documents/Code/…/virtualenv/lib/python3.8/site-packages/IPython/core/formatters.py in __call__(self, obj)
    700                 type_pprinters=self.type_printers,
    701                 deferred_pprinters=self.deferred_printers)
--> 702             printer.pretty(obj)
    703             printer.flush()
    704             return stream.getvalue()

~/Documents/Code/…/virtualenv/lib/python3.8/site-packages/IPython/lib/pretty.py in pretty(self, obj)
    380                 if cls in self.type_pprinters:
    381                     # printer registered in self.type_pprinters
--> 382                     return self.type_pprinters[cls](obj, self, cycle)
    383                 else:
    384                     # deferred printer

~/Documents/Code/…/virtualenv/lib/python3.8/site-packages/IPython/lib/pretty.py in _type_pprint(obj, p, cycle)
    681         p.text(name)
    682     else:
--> 683         p.text(mod + '.' + name)
    684 
    685 

TypeError: unsupported operand type(s) for +: 'property' and 'str'
tehfink commented 6 months ago

Still having this issue with Python 3.12.2. What's the best way to check if an AwaitableOnly has been initialized? Using something simple like if not instance.value: … doesn't seem to work.