gaogaotiantian / objprint

A library that can print Python objects in human readable format
Apache License 2.0
519 stars 43 forks source link

Duplicate output when op() argument wasn't an object. #78

Closed CokeStudios closed 2 years ago

CokeStudios commented 2 years ago

import hashlib op(hashlib) <module 'hashlib' from 'C:\Users\guojoan\AppData\Local\Programs\Python\Python310\lib\hashlib.py'> <module 'hashlib' from 'C:\Users\guojoan\AppData\Local\Programs\Python\Python310\lib\hashlib.py'>

a = [] a.append(a) op(a) [[ ... ]] [[...]]

and so on

gaogaotiantian commented 2 years ago

Are you using an REPL? As op returns the object, so REPL will print the returned object, which will result in print the object twice(one by op and another one by an implicit print). This is track in #73 and I probably will figure out a way to detect REPL and change the behavior.

CokeStudios commented 2 years ago

Yeah and I'll close this issue.