Can't understand python C apis

2012-06-23 Thread gmspro
I'm trying to understand the source code of python and how it works internally. But i can't understand the python C apis. Too much macro calling there and python C api. I can't understand those. I've also read the doc for python C api. What should i do? Which file's code should i read to understan

Re: Can't understand python C apis

2012-06-23 Thread Stefan Behnel
gmspro, 23.06.2012 09:02: > I'm trying to understand the source code of python and how it works > internally. > But i can't understand the python C apis. > Too much macro calling there and python C api. > I can't understand those. > I've also read the doc for python C api. > > What should i do? W

Re: Can't understand python C apis

2012-06-23 Thread Dieter Maurer
gmspro writes: > I'm trying to understand the source code of python and how it works > internally. > But i can't understand the python C apis. Usually, you try to understand the Python C api in order to write extensions for Pyth

cPickle - sharing pickled objects between scripts and imports

2012-06-23 Thread Rotwang
Hi all, I have a module that saves and loads data using cPickle, and I've encountered a problem. Sometimes I want to import the module and use it in the interactive Python interpreter, whereas sometimes I want to run it as a script. But objects that have been pickled by running the module as a

Re: cPickle - sharing pickled objects between scripts and imports

2012-06-23 Thread Peter Otten
Rotwang wrote: > Hi all, I have a module that saves and loads data using cPickle, and > I've encountered a problem. Sometimes I want to import the module and > use it in the interactive Python interpreter, whereas sometimes I want > to run it as a script. But objects that have been pickled by runn

Re: emded revision control in Python application?

2012-06-23 Thread duncan smith
On 23/06/12 06:45, rusi wrote: On Jun 22, 8:58 pm, duncan smith wrote: Hello, I have an application that would benefit from collaborative working. Over time users construct a "data environment" which is a number of files in JSON format contained in a few directories (in the future I'll p

SSL handshake hanging, despite bugfix in stdlib

2012-06-23 Thread Michael Gundlach
Hello, http://bugs.python.org/issue5103 fixed a bug in Python2.6 where SSL's handshake would hang indefinitely if the remote end hangs. However, I'm getting hanging behavior in an IMAP script. When I Ctrl-C it after hours of hanging, I get the same stacktrace as reported in http://bugs.python.or

Re: cPickle - sharing pickled objects between scripts and imports

2012-06-23 Thread Dave Angel
On 06/23/2012 12:13 PM, Peter Otten wrote: > Rotwang wrote: > >> Hi all, I have a module that saves and loads data using cPickle, and >> I've encountered a problem. Sometimes I want to import the module and >> use it in the interactive Python interpreter, whereas sometimes I want >> to run it as a

Re: cPickle - sharing pickled objects between scripts and imports

2012-06-23 Thread Rotwang
On 23/06/2012 17:13, Peter Otten wrote: Rotwang wrote: Hi all, I have a module that saves and loads data using cPickle, and I've encountered a problem. Sometimes I want to import the module and use it in the interactive Python interpreter, whereas sometimes I want to run it as a script. But obj

Re: cPickle - sharing pickled objects between scripts and imports

2012-06-23 Thread Rotwang
On 23/06/2012 18:31, Dave Angel wrote: On 06/23/2012 12:13 PM, Peter Otten wrote: Rotwang wrote: Hi all, I have a module that saves and loads data using cPickle, and I've encountered a problem. Sometimes I want to import the module and use it in the interactive Python interpreter, whereas some

Re: cPickle - sharing pickled objects between scripts and imports

2012-06-23 Thread Steven D'Aprano
On Sat, 23 Jun 2012 19:14:43 +0100, Rotwang wrote: > The problem is that if the object was > pickled by the module run as a script and then unpickled by the imported > module, the unpickler looks in __main__ rather than mymodule for the > object's class, and doesn't find it. Possibly the solutio

Why is python source code not available on github?

2012-06-23 Thread gmspro
Why is python source code not available on github? Make it available on github so that we can git clone and work on source code. -- http://mail.python.org/mailman/listinfo/python-list

Re: Why is python source code not available on github?

2012-06-23 Thread George Silva
http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tar.bz2 On Sat, Jun 23, 2012 at 9:16 PM, gmspro wrote: > Why is python source code not available on github? > > Make it available on github so that we can git clone and work on source > code. > > -- > http://mail.python.org/mailman/listinfo/pyt

Re: Why is python source code not available on github?

2012-06-23 Thread Andrew Berg
On 6/23/2012 7:16 PM, gmspro wrote: > Why is python source code not available on github? If you mean CPython, it's because the devs use Mercurial and have their own hosting on python.org. hg clone http://hg.python.org/cpython http://docs.python.org/devguide/setup.html github is far from the only

Re: Why is python source code not available on github?

2012-06-23 Thread Chris Angelico
On Sun, Jun 24, 2012 at 10:16 AM, gmspro wrote: > > Why is python source code not available on github? > > Make it available on github so that we can git clone and work on source > code. It's done with Mercurial, not git, but the same can be done: hg clone http://hg.python.org/cpython ChrisA --

Re: Why is python source code not available on github?

2012-06-23 Thread gmspro
No, I can download as .tar.bz2, but i'm talking about using git. git clone, git add ., git commit -a, git push is easier to keep track of my code. Then for git pull request. --- On Sat, 6/23/12, George Silva wrote: From: George Silva Subject: Re: Why is python source code not available on gith

Re: Why is python source code not available on github?

2012-06-23 Thread Chris Angelico
On Sun, Jun 24, 2012 at 10:34 AM, gmspro wrote: > > No, > I can download as .tar.bz2, but i'm talking about using git. > git clone, git add ., git commit -a, git push is easier to keep track of > my code. Then for git pull request. Mercurial can do all that. I'm not as familiar with it as I am wi

Filenames started with _(underscore) in Modules/ why?

2012-06-23 Thread gmspro
There are some files whose filename is started with _(underscore). Why are they started with a underscore? -- http://mail.python.org/mailman/listinfo/python-list

Re: Filenames started with _(underscore) in Modules/ why?

2012-06-23 Thread Thomas Jollans
On 06/24/2012 02:54 AM, gmspro wrote: There are some files whose filename is started with _(underscore). Why are they started with a underscore? By convention, a leading underscore means private/internal. A module with a leading underscore is typically an implementation detail of another modu

Getting lazy with decorators

2012-06-23 Thread Josh English
I'm creating a cmd.Cmd class, and I have developed a helper method to easily handle help_xxx methods. I'm trying to figure out if there is an even lazier way I could do this with decorators. Here is the code: * import cmd def add_help(func): if not hasattr(func, 'im_cl

How can i call array_length to get the length of array object?

2012-06-23 Thread gmspro
Hi, I tried this, >>> import array >>> from array import array >>> arr=array('i',[5,7,8]) >>> arr.sg_length Traceback (most recent call last):   File "", line 1, in AttributeError: 'array.array' object has no attribute 'sg_length' >>> arr=array('i'[5,8,7]) Traceback (most recent call last):   Fi

Re: How can i call array_length to get the length of array object?

2012-06-23 Thread Ignacio Mondino
On Sat, Jun 23, 2012 at 11:23 PM, gmspro wrote: > > Hi, > > I tried this, > >>> import array > >>> from array import array > >>> arr=array('i',[5,7,8]) > >>> arr.sg_length > Traceback (most recent call last): >   File "", line 1, in > AttributeError: 'array.array' object has no attribute 'sg_leng

Re: How can i call array_length to get the length of array object?

2012-06-23 Thread gmspro
@Ignacio Mondino, Doesn't it call this : http://hg.python.org/cpython/file/c0eab397f098/Python/bltinmodule.c#l1283 instead of this: http://hg.python.org/cpython/file/3b7230997425/Modules/arraymodule.c#l657 --- On Sat, 6/23/12, Ignacio Mondino wrote: From: Ignacio Mondino Subject: Re: How ca

Re: SSL handshake hanging, despite bugfix in stdlib

2012-06-23 Thread Terry Reedy
On 6/23/2012 1:29 PM, Michael Gundlach wrote: Hello, http://bugs.python.org/issue5103 fixed a bug in Python2.6 where SSL's I believe the fix first appeared in 2.6.6. handshake would hang indefinitely if the remote end hangs. However, I'm getting hanging behavior in an IMAP script. When I C

Re: How can i call array_length to get the length of array object?

2012-06-23 Thread Ian Kelly
On Sat, Jun 23, 2012 at 8:23 PM, gmspro wrote: > I'm trying to call this function, > http://hg.python.org/cpython/file/3b7230997425/Modules/arraymodule.c#l657 > > Is that possible to call that function? > > I know it's possible to do: > >>>len(arr) You call it just like that. array_length is th