473,804 Members | 2,280 Online
Bytes | Software Development & Data Engineering Community
+ 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 1428
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...@america n.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=('__mo dule__', '__name__',
'__doc__'), updated=('__dic t__',))
Source:
def wraps(wrapped,
assigned = WRAPPER_ASSIGNM ENTS,
updated = WRAPPER_UPDATES ):
"""Decorato r 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=assign ed, 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*********@wes terngeco.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
18843
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 they are too big and wind up covering up some of the fields on the main form. Is there any good code out there that works in a similar fashion that will also either a) stretch the form width wise on widescreens or b), rely on height rather than...
9
3351
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 visible to a client using a browser. My question is...can a knowledgeable browser user view Jscript source code in an asp file?
88
8105
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
1959
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 of string manipulation where they seek through the string back and forth doing replacements to substitute in the needed HTML code. I am convinced that this can be done with a few regular expressions. Unfortunately my knowledge of regular...
17
4721
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
9594
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10599
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10090
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9173
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7635
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5673
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4308
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3832
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3001
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.