By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,923 Members | 1,655 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,923 IT Pros & Developers. It's quick & easy.

modules...n methods

P: n/a
lee
First of all thnx guys for ur cover on ma questions....Ok some more
then...whats the way to read the sourcecode of methods and built in
functions?

Jan 12 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
lee wrote:
whats the way to read the sourcecode of methods
Easy. Look up the .py file and open it in an editor of your choice.
Those files are, for example, in "/usr/lib/python".
and built in functions?
Get your python interpreter's source code and look up the functions
there.

Regards,
Björn

--
BOFH excuse #370:

Virus due to computers having unsafe sex.

Jan 12 '07 #2

P: n/a

On Jan 12, 2007, at 8:56 AM, Bjoern Schliessmann wrote:
lee wrote:
>whats the way to read the sourcecode of methods

Easy. Look up the .py file and open it in an editor of your choice.
Those files are, for example, in "/usr/lib/python".
>and built in functions?
This becomes a lot easier if you use IPython (which embellishes the
python shell in many useful ways). For instance, I did a "dir
(__builtins__)" to find out what some of the builtin functions were.
One was called "zip". Here's what I do in IPython to get help on that
function:

In [2]: zip??
Type: builtin_function_or_method
Base Class: <type 'builtin_function_or_method'>
String Form: <built-in function zip>
Namespace: Python builtin
Docstring [source file open failed]:
zip(seq1 [, seq2 [...]]) -[(seq1[0], seq2[0] ...), (...)]

Return a list of tuples, where each tuple contains the i-th element
from each of the argument sequences. The returned list is
truncated
in length to the length of the shortest argument sequence.

Note that IPython's prompt is (by default) different than pythons---
the "In[<some number>]:". Any identifier you have a question about
will produce summary info via "<identifier>?" and summary + source
via "<identifier>??".

HTH
--b
Jan 12 '07 #3

P: n/a
belinda thom wrote:
This becomes a lot easier if you use IPython (which embellishes
the python shell in many useful ways). For instance, I did a "dir
(__builtins__)" to find out what some of the builtin functions
were.
Sure.
HTH
I'm sorry, it doesn't help me.

And *please* don't send mail copies to me.

Regards,
Björn

--
BOFH excuse #14:

sounds like a Windows problem, try calling Microsoft support

Jan 13 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.