473,473 Members | 1,976 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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

Jun 27 '08 #1
3 1404
Anand Patil wrote:
If you're using IPython, you can do svd?? .

http://www.scipy.org/doc/numpy_api_d...lg.linalg.html

hth,
Alan Isaac
Jun 27 '08 #2
On May 30, 8:54 am, Alan Isaac <ais...@american.eduwrote:
Anand Patil wrote:
If you're using IPython, you can do svd?? .

http://www.scipy.org/doc/numpy_api_d...lg.linalg.html

hth,
Alan Isaac
That wasn't a question :) In IPython, '<entity>?' is roughly
equivalent to 'help(<entity>)', whereas '<entity>??' 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: <type 'function'>
String Form: <function wraps at 0x00CF31B0>
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.
Jun 27 '08 #3
alex23 <wu*****@gmail.comwrites:
Which is very handy, like most of IPython.
+1 QOTW
--
Pete Forman -./\.- Disclaimer: This post is originated
WesternGeco -./\.- by myself and does not represent
pe*********@westerngeco.com -./\.- the opinion of Schlumberger or
http://petef.22web.net -./\.- WesternGeco.
Jun 27 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Jozef | last post by:
I have some old code that I use from the Access 95 Developers handbook. The code works very well, with the exception that it doesn't seem to recognize wide screens, and sizes tab controls so that...
9
by: WRH | last post by:
Hello I am new to asp but I made some Jscript functions which work fine. The functions contain some strings used as a registration key for some apps. It is important that these strings not be...
88
by: Peter Olcott | last post by:
Cab you write code directly in the Common Intermediate language? I need to optimize a critical real-time function.
0
by: peridian | last post by:
Hi, I wanted a web page where I could post code to, and have it appear in coloured formatting based on the context of the code. Most of the techniques I have seen for this involve complex use...
17
by: radhikams | last post by:
Hi I want to create a drag drop tool box using javascript... Can anyone please guide me in this regard Thanks
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.