473,289 Members | 1,866 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,289 software developers and data experts.

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 1395
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
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

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.