reading help() - newbie question

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Sat Jun 5 05:38:12 EDT 2010


On 31 mayo, 07:19, Payal <payal-pyt... at scriptkitchen.com> wrote:

> When I type help(something) e.g. help(list), I see many methods like,
> __methodname__(). Are these something special? How do I use them and why
> put "__" around them?

You may want to install and use "see", a human-friendly replacement of
dir()

So instead of this mess:

    py> dir(pencil_case)
    ['__add__', '__class__', '__contains__', '__delattr__',
'__delitem__', '
    __delslice__', '__doc__', '__eq__', '__ge__', '__getattribute__',
'__get
    item__', '__getslice__', '__gt__', '__hash__', '__iadd__',
'__imul__', '
    __init__', '__iter__', '__le__', '__len__', '__lt__', '__mul__',
'__ne__
    ', '__new__', '__reduce__', '__reduce_ex__', '__repr__',
'__reversed__',
     '__rmul__', '__setattr__', '__setitem__', '__setslice__',
'__str__', 'a
    ppend', 'count', 'extend', 'index', 'insert', 'pop', 'remove',
'reverse'
    , 'sort']

you get this instead:

    py> see(pencil_case)
        []           in           +            +=
*            *=
        <            <=           ==           !=
>            >=
        hash()       help()       iter()       len()        repr()
        reversed()
str()        .append()    .count()     .extend()    .index()
        .insert()    .pop()       .remove()    .reverse()   .sort()


For us mere mortals, it's a lot more readable.
"see" is available at http://github.com/inky/see


--
Gabriel Genellina



More information about the Python-list mailing list