[Python-bugs-list] [ python-Bugs-672578 ] pydoc does not cope well with lambda
SourceForge.net
noreply@sourceforge.net
Wed, 22 Jan 2003 17:55:19 -0800
Bugs item #672578, was opened at 2003-01-22 12:29
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=672578&group_id=5470
Category: Demos and Tools
Group: Python 2.2.1
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Jim Meyer (purp)
Assigned to: Nobody/Anonymous (nobody)
Summary: pydoc does not cope well with lambda
Initial Comment:
pydoc doesn't deal well with lambda expressions. Here's
some sample code:
================================================================
#!/usr/bin/env python2
"""a bogus program
Demonstrate that pydoc doesn't handle lambdas well
"""
#
--------------------------------------------------------------------
# A comment heading
#
--------------------------------------------------------------------
def foo (optional = 1) :
''' A bogus function '''
return optional
bar = lambda opt : foo(opt)
================================================================
...and here's what pydoc says:
================================================================
> pydoc /tmp/foo.py
Python Library Documentation: module foo
NAME
foo - a bogus program
FILE
/tmp/foo.py
DESCRIPTION
Demonstrate that pydoc doesn't handle lambdas well
FUNCTIONS
lambdaopt
#
--------------------------------------------------------------------
# A comment heading
#
--------------------------------------------------------------------
foo(optional=1)
A bogus function
DATA
__file__ = '/tmp/foo.pyc'
__name__ = 'foo'
================================================================
I'm looking for the cause now and hope to contribute a
patch shortly.
--j
----------------------------------------------------------------------
>Comment By: Raymond Hettinger (rhettinger)
Date: 2003-01-22 20:55
Message:
Logged In: YES
user_id=80475
The underlying cause is that the inspect module was not
trained to handle lambdas or single line function defintions
like:
def oneliner(x): return x**2
The problem was fixed in Py2.3 and backported for
Py2.2.3.
Marking as fixed and closing.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=672578&group_id=5470