Re: code of a function
alex23 <[EMAIL PROTECTED]> writes: > Which is very handy, like most of IPython. +1 QOTW -- Pete Forman-./\.- Disclaimer: This post is originated WesternGeco -./\.- by myself and does not represent [EMAIL PROTECTED]-./\.- the opinion of Schlumberger or http://petef.22web.net -./\.- WesternGeco. -- http://mail.python.org/mailman/listinfo/python-list
Re: code of a function
On May 30, 8:54 am, Alan Isaac <[EMAIL PROTECTED]> wrote: > Anand Patil wrote: > > If you're using IPython, you can do svd?? . > > http://www.scipy.org/doc/numpy_api_docs/numpy.linalg.linalg.html > > hth, > Alan Isaac That wasn't a question :) In IPython, '?' is roughly equivalent to 'help()', whereas '??' displays the code, if possible: IPython 0.8.2 -- An enhanced Interactive Python. ? -> Introduction and overview of IPython's features. %quickref -> Quick reference. help -> Python's own help system. object? -> Details about 'object'. ?object also works, ?? prints more. In [1]: from functools import wraps In [2]: wraps?? Type: function Base Class: String Form: Namespace: Interactive File: c:\python25\lib\functools.py Definition: wraps(wrapped, assigned=('__module__', '__name__', '__doc__'), updated=('__dict__',)) Source: def wraps(wrapped, assigned = WRAPPER_ASSIGNMENTS, updated = WRAPPER_UPDATES): """Decorator factory to apply update_wrapper() to a wrapper function Returns a decorator that invokes update_wrapper() with the decorated function as the wrapper argument and the arguments to wraps() as the remaining arguments. Default arguments are as for update_wrapper(). This is a convenience function to simplify applying partial() to update_wrapper(). """ return partial(update_wrapper, wrapped=wrapped, assigned=assigned, updated=updated) Which is very handy, like most of IPython. -- http://mail.python.org/mailman/listinfo/python-list
Re: code of a function
Anand Patil wrote: If you're using IPython, you can do svd?? . http://www.scipy.org/doc/numpy_api_docs/numpy.linalg.linalg.html hth, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list
Re: code of a function
On May 29, 2008, at 9:38 AM, Gary Herron wrote: Dark Wind wrote: Hi, Is there any command in Python which gives the code for a function like just typing the name of a function (say svd) in R returns its code. Thank you Nope. If you're using IPython, you can do svd?? . -- http://mail.python.org/mailman/listinfo/python-list
Re: code of a function
Dark Wind schrieb: > Hi, > > Is there any command in Python which gives the code for a function like just > typing the name of a function (say svd) in R returns its code. Yes, it's posible to retrieve the source code IFF the function is implemented in Python and the .py file is available, too. >>> print inspect.getsource(inspect.getsource) def getsource(object): """Return the text of the source code for an object. The argument may be a module, class, method, function, traceback, frame, or code object. The source code is returned as a single string. An IOError is raised if the source code cannot be retrieved.""" lines, lnum = getsourcelines(object) return string.join(lines, '') -- http://mail.python.org/mailman/listinfo/python-list
Re: code of a function
On Thu, May 29, 2008 at 9:10 AM, Dark Wind <[EMAIL PROTECTED]> wrote: > Hi, > > Is there any command in Python which gives the code for a function like > just typing the name of a function (say svd) in R returns its code. > > Thank you > If you're using IPython, you can type svd?? . -- http://mail.python.org/mailman/listinfo/python-list
Re: code of a function
Dark Wind wrote: Hi, Is there any command in Python which gives the code for a function like just typing the name of a function (say svd) in R returns its code. Thank you Nope. -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
code of a function
Hi, Is there any command in Python which gives the code for a function like just typing the name of a function (say svd) in R returns its code. Thank you -- http://mail.python.org/mailman/listinfo/python-list