-
-
Couldn't load subscription status.
- Fork 19
Description
Hi,
would it be possible to provide a shorter string representation (repr) for a module object, primarily when returned by the import function?
Currently, the repr includes the module's file path, which can be visually very annonying, especially when displayed in notebooks. For example, importing the pytest module in the REPL returns:
asilisp.user=> (import pytest)
<module 'pytest' from 'C:\\src\\basilisp\\.venv\\Lib\\site-packages\\pytest\\__init__.py'>I think it would have been better to have it reprd keeping the start of the string only
<module 'pytest'>
or simply just the module name
pytest
This would improve readability and align better with user expectations in environments like notebooks.
It seems to me this could be achieved by overloading the module's class __repr__ method, though I'm not entirely sure how to implement this.
For comparison, Clojure imports already use a shorter and cleaner representation, which is easier on the eyes:
> clj
Clojure 1.12.0
user=> (import java.util.Date)
java.util.Date
user=> (import (java.util Date Calendar) (java.net URI ServerSocket))
java.net.ServerSocketThanks