holoviz / holoviz/param

IPython extension causes confusing help text?

Open
#115 1 comment 0 reactions 0 assignees View on GitHub
component: ipython doc
Dominant language
Python
Stars
521
Forks
86
Avg merge
1d 13h
Merged PRs (30d)
35

Description

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:

``` 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`):

![ipython](https://cloud.githubusercontent.com/assets/1929/7276051/44f1bc84-e8ff-11e4-95d4-4b464ae91fb9.png)

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).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.