473,508 Members | 2,298 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

naive doc question

Is it just me that can't find a full reference in the docs?

I wanted a list of all the methods of dict for example... where can i find it?

Thanks, and sorry if this question is just dumb, i really can't find it
Jul 18 '05 #1
2 1145
I wouldn't call the responses here helpful; they seem overspecific. I
had a similar problem which led to the follwing code. After I came up
with this I saw a very similar utility was derived in Dive into Python.
see
http://diveintopython.org/power_of_i...ihelper.divein

Anyway the following is intended as an interactive utility to explore
the callables of modules and classes. I always have it imported into my
interactive sessions.

So import it and try

sm(dict)

..################################################ ########
..# sm()
..# showmethods
..
..def sm(namespace,terse=0,maxchars=300):
..
.. """report the callables of a namespace
..
..returns a nice string representation of the public callables of the
..namespace and the first maxchars bytes of their respective docstrings
..
..if terse, truncates the docstring at the first newline
.. """
..
.. d = namespace.__dict__
.. l = [str(x) + "\t\t" + str(d[x].__doc__)[:maxchars] for x in
d.keys() \
.. if callable(d[x]) and not x.startswith("_")]
.. if terse:
.. l = [x.split("\n")[0] for x in l]
.. l.sort()
.. return "\n=====\n".join(l)

Jul 18 '05 #2
Gabriel B. wrote:
Is it just me that can't find a full reference in the docs?

I wanted a list of all the methods of dict for example... where can i
find it?

Thanks, and sorry if this question is just dumb, i really can't find
it


If you want to find out about all the methods of dict then try:

lib\pydoc.py dict

from a shell prompt, or
help(dict)


from the interactive interpreter.

The catch is that many of the methods that will be shown aren't really
relevant to dictionaries, so you will need to ignore the irrelevant ones.

Run pydoc interactively ('lib\pydoc.py -g') or as a web-server if you want
to get the output as strangely coloured html. e.g. 'lib\pydoc.py -p 8081'
then point your browser at 'http://localhost:8081/dict' for help on the
dict type. (Pick a different port number if 8081 is used on your machine.)

http://localhost:8081/__builtin__ is a good starting point to browse the
builtin types, and http://localhost:8081/ will give you an index of all the
modules installed on your system.

Jul 18 '05 #3

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

Similar topics

5
1452
by: Waqas | last post by:
HI guys, sorry for being naive, but i have wasted alot of time searching for a undergrad. project but cannot come up with anything. can someone generously suggect me something so that i can move...
9
1561
by: JohnSouth104 | last post by:
Hi I've an asp.net, c#, sql server website and the volumes are starting to rise quickly. I've been asked to look at improving the memory usage of the application. I've not looked at this before...
7
1504
by: sillyhat | last post by:
Hello, Can someone please help. I have come across code similar to this which I prepared as an example:- /*-------------8<------------------*/ #define ASIZE 10 int main() {
7
1407
by: Rory Campbell-Lange | last post by:
I have a number of web applications which have a large amount of their logic written in plpgsql. For each particular application I have a separate instance of a database. If I need to update...
2
1438
by: Rob Clark | last post by:
Hello all, I have a design problem for which my current C++ solution feels more like a hack. :-( I'd like to change that :-) The real problem can be destilled to something like this: One...
3
1653
by: johan2sson | last post by:
The documentation for PyThreadState_SetAsyncExc says "To prevent naive misuse, you must write your own C extension to call this". Anyone care to list a few examples of such naive misuse? Johan
3
4878
by: pragy | last post by:
Hey, can any one help me for writing a program of naive gauss elimintaion technique? It's a technique to solve system of simultaneous linear equations using matrix. thanks
17
1692
by: Christopher Benson-Manica | last post by:
Some recent posts got me thinking about how one might have dealt with simplistic malloc() implementations which might return NULL for a 64K request but might accept two 32K requests or four 16K...
1
2477
by: mjm2114 | last post by:
Hi there, I have a question on a naive implementation of a parallel MT that I've done using the fortran version of MT19937ar.f posted in Prof. Matsumoto's website....
0
7225
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7324
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,...
0
7382
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7042
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
4707
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
3193
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1556
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 ...
1
766
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
418
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.