If I'm using ipython and I run %load_ext param.ipython everything seems good. But if I'm not using ipython, or if I use ipython without loading the ipython extension, I think the help text for a parameterized instance is confusing.
Standard python:
>>> import param
>>> class X(param.Parameterized):
... y = param.Parameter(default=1)
...
>>> x = X(y=10)
>>> x.y
10
>>> help(x)
Gives me:
Help on X in module __main__ object:
class X(param.parameterized.Parameterized)
| params(y=Parameter, name=String)
| ESC[1;32mParameters of 'X'
| =================
| ESC[0m
| ESC[1;31mParameters changed from their default values are marked in red.ESC[0m
| ESC[1;36mSoft bound values are marked in cyan.ESC[0m
| C/V= Constant/Variable, RO/RW = ReadOnly/ReadWrite, AN=Allow None
|
| ESC[1;34mNameValue Type Mode ESC[0m
|
| y 1 Parameter V RW
|
| ESC[1;32mParameter docstrings:
| =====================ESC[0m
|
| ESC[1;34my: < No docstring available >ESC[0m
|
...
Maybe my terminal's not very clever, so it can't display colors, but you can see that there was no attempt to color the y line, and the value shown is the default rather than the actual value.
Additionally, the attached screenshot shows the result from within ipython (without having run %load_ext param.ipython):
If I deliberately stop the ipython extension from importing when I import param, here's what I get instead for help(x):
Help on X in module __main__ object:
class X(param.parameterized.Parameterized)
| params(y=Parameter, name=String)
|
| Method resolution order:
| X
| param.parameterized.Parameterized
| __builtin__.object
|
| Data descriptors defined here:
|
| name
| String identifier for this object.
|
| y
|
| ----------------------------------------------------------------------
...
i.e. no attempt to show the current value or say if it's changed from the default (so at least it doesn't mislead).
If I'm using ipython and I run
%load_ext param.ipython
everything seems good. But if I'm not using ipython, or if I use ipython without loading the ipython extension, I think the help text for a parameterized instance is confusing.Standard python:
Gives me:
Maybe my terminal's not very clever, so it can't display colors, but you can see that there was no attempt to color the
y
line, and the value shown is the default rather than the actual value.Additionally, the attached screenshot shows the result from within ipython (without having run
%load_ext param.ipython
):If I deliberately stop the ipython extension from importing when I import param, here's what I get instead for
help(x)
:i.e. no attempt to show the current value or say if it's changed from the default (so at least it doesn't mislead).