dgrunwald / rust-cpython

Rust <-> Python bindings
MIT License
1.81k stars 136 forks source link

Printing PyModule #148

Open iddan opened 6 years ago

iddan commented 6 years ago

When I tried to do:

let module = py.import(".module")?;
println!("{:?}", module);

The compiler failed with

The trait `std::fmt::Debug` is not implemented for `cpython::PyModule`
ssokolow commented 6 years ago

I agree that this would be a useful diagnostic tool.

The equivalent capability via the Python REPL has rescued me from confusion on multiple occasions:

>>> import os
>>> os
<module 'os' from '/usr/lib/python2.7/os.pyc'>