[Q] Function Point Analysis (FPA) - Equivalent lines of code of Python

2010-09-09 Thread Nicholas
Hi, In FPA, there are tables which shows equivalent lines of code for each Function Point (FP) for a number of programming languages. e.g. http://www.qsm.com/?q=resources/function-point-languages-table/index.html However, I have yet to find the figures for Python. Is someone able to adv

Re: are there pros or contras, keeping a connection to a (sqlite) database ?

2010-09-09 Thread News123
On 09/09/2010 12:29 AM, CM wrote: > On Sep 8, 1:09 pm, Stef Mientki wrote: >> hello, >> >> I wrap my database in some class, and on creation of the instance, a >> connection to the database is >> created, >> and will stay connected until the program exists, something like this: >> >> self.co

Re: [Q] Function Point Analysis (FPA) - Equivalent lines of code of Python

2010-09-09 Thread Paul Rubin
Nicholas writes: > e.g. > http://www.qsm.com/?q=resources/function-point-languages-table/index.html > However, I have yet to find the figures for Python. > Is someone able to advise the closest language equivalent. That table looks pretty bogus, but of the languages on the list, perl is pr

SendKeys and Python 2.7

2010-09-09 Thread Jakson A. Aquino
Hi, I would like to send code from Vim [1] to R [2] on Microsoft Windows. Vim needs python 2.7 but the pre-compiled SendKeys module [3] is only avaiable for python 2.6. How can I make SendKeys work with python 2.7? I don't know how to compile python code. Is there an alternative to SendKeys? I'm

Re: [Tutor] Arguments from the command line

2010-09-09 Thread Martin Gregorie
On Wed, 08 Sep 2010 21:58:49 -0700, Dennis Lee Bieber wrote: > On Thu, 09 Sep 2010 12:38:04 +1200, Lawrence D'Oliveiro > declaimed the following in > gmane.comp.python.general: > >> In message , Hugo >> Arts wrote: >> >> > sys.argv is a list of all arguments from the command line ... >> >> Int

cath a timeout of httplib (Python 2.6.5)

2010-09-09 Thread Mauricio Martinez Garcia
Hi!. I have a problem with httplib and timeout. (I use python 2.6.5 and httplib) I have the next code for the http connection (its a WebService Client). === def ejecutaComandos(self,opcion, URL, commandString, conn, id):

32 bit bdist_wininst vs x64 platform

2010-09-09 Thread Robin Becker
A reportlab user is using 32 bit python on x64 win 2003. he has a problem installing our bdist_wininst exe because the installer cannot find python. Apparently the installer is looking at HKLM\Software to locate python, but on x64 32 bit program requests get redirected to HKLM\Software\Wow6432

Re: SendKeys and Python 2.7

2010-09-09 Thread Albert Hopkins
On Thu, 2010-09-09 at 07:07 -0300, Jakson A. Aquino wrote: > Vim needs python 2.7 >From where do you base this assertion? I have been using vim 7.3 (with embedded python) with python 2.6 pretty much since it has been released. :version VIM - Vi IMproved 7.3 (2010 Aug 15, compiled

importing module

2010-09-09 Thread Holzwarth, Dominique (Berne Branch)
Hi all Lets assume I have the following structure of directories and python modules: Root-dir |_dir1 |_ script1.py |_dir2 |_ script2.py |_sudir2 |_ script3.py Is it possible to import script1 into script2 and script3? Or do have to put script1.py into the Lib\site-packages folder of

Catching a SIGSEGV signal on an import

2010-09-09 Thread Ryan
Is there anyway to catch a SIGSEGV signal that results from an import? I'd like to get a list of all modules on the sys.path. The module pkgutil has a nice method, walk_packages, to do just that. But, there is a third party extension that throws a SIGSEGV when imported. I tried to create a signal h

Re: importing module

2010-09-09 Thread Peter Otten
Holzwarth, Dominique (Berne Branch) wrote: > Hi all > > Lets assume I have the following structure of directories and python > modules: > > Root-dir > |_dir1 > |_ script1.py > |_dir2 > |_ script2.py > |_sudir2 > |_ script3.py > > Is it possible to import script1 into script2 and scri

Re: [Tutor] Arguments from the command line

2010-09-09 Thread Mel
Dennis Lee Bieber wrote: > On Thu, 09 Sep 2010 12:38:04 +1200, Lawrence D'Oliveiro > declaimed the following in > gmane.comp.python.general: > >> In message , Hugo >> Arts wrote: >> >> > sys.argv is a list of all arguments from the command line ... >> >> Interesting that Python didn’t bother t

Re: [Tutor] Arguments from the command line

2010-09-09 Thread Giacomo Boffi
Dennis Lee Bieber writes: > FORTRAN just differentiates by having the main file start with > PROGRAM random_name > whereas subfiles are all either (or both) > SUBROUTINE another_name(args) > FUNCTION that_other_name(args) no BLOCKDATA? -- http://m

Re: cPickle segfault with nested dicts in threaded env

2010-09-09 Thread Kenneth Dombrowski
On Wed, Sep 8, 2010 at 6:55 PM, Paul Rubin wrote: > Carl Banks writes: >> Since Python 2.7 is released, Python 2.5 is no longer accepting bug >> fixes, only security fixes.  So be aware. > > Segfaults should be treated as security holes unless there's convincing > reasons that no exploit is possi

Python script for repairing .mov file ?

2010-09-09 Thread ctops.legal
Jave is much better; http://yfrog.com/naattempt1hj -- http://mail.python.org/mailman/listinfo/python-list

how to extract an implicit dict expression (with statement return)

2010-09-09 Thread Fritz Loseries
Hi, I do not know how to subject my problem in a better way. I have the following statement: return [ dict(x1 = elem.x1, x2 = elem.x2, x3 = elem.x3,) for elem in method(in_values) ] How can I transform it to an explicit description: result = ... return

Re: how to extract an implicit dict expression (with statement return)

2010-09-09 Thread Benjamin Kaplan
On Thu, Sep 9, 2010 at 11:20 AM, Fritz Loseries wrote: > Hi, > > I do not know how to subject my problem in a better way. > > I have the following statement: > >    return [ dict(x1 = elem.x1, x2 = elem.x2, x3 = elem.x3,) >                for elem in method(in_values) >              ] > > How can

Re: [Python-ideas] with statement syntax forces ugly line breaks?

2010-09-09 Thread Mark Lawrence
On 08/09/2010 20:30, MRAB wrote: On 08/09/2010 19:07, Georg Brandl wrote: Thus spake the Lord: Thou shalt indent with four spaces. No more, no less. Four shall be the number of spaces thou shalt indent, and the number of thy indenting shall be four. Eight shalt thou not indent, nor either indent

Re: Slice a list of lists?

2010-09-09 Thread Mark Lawrence
On 08/09/2010 21:23, Jonno wrote: On Wed, Sep 8, 2010 at 3:18 PM, Jonno wrote: On Wed, Sep 8, 2010 at 3:06 PM, Jonno wrote: On Wed, Sep 8, 2010 at 2:11 PM, Benjamin Kaplan wrote: On Wed, Sep 8, 2010 at 2:55 PM, Jonno wrote: I know that I can index into a list of lists like this: a=[[1,2,

Re: [Python-ideas] with statement syntax forces ugly line breaks?

2010-09-09 Thread MRAB
On 09/09/2010 17:07, Mark Lawrence wrote: On 08/09/2010 20:30, MRAB wrote: On 08/09/2010 19:07, Georg Brandl wrote: Thus spake the Lord: Thou shalt indent with four spaces. No more, no less. Four shall be the number of spaces thou shalt indent, and the number of thy indenting shall be four. Eig

Re: Slice a list of lists?

2010-09-09 Thread Jonno
On Thu, Sep 9, 2010 at 10:58 AM, Robert Kern wrote: > Please keep responses on the mailing list. However, I will reply below > this one time. > > On Thu, Sep 9, 2010 at 10:35, Jonno wrote: >> On Wed, Sep 8, 2010 at 4:26 PM, Robert Kern wrote: >>> A motivating example: >>> >>> [~] >>> |1> import

Re: Difference between queues and pipes in multiprocessing

2010-09-09 Thread Ethan Furman
James Mills wrote: On Wed, Aug 4, 2010 at 7:20 PM, Navkirat Singh wrote: I was wondering what are the differences between queues and pipes implemented using multiprocessing python module. Am I correct if I say, in pipes, if another process writes to one receiving end concurrently, then an err

Printing the name of a variable

2010-09-09 Thread Stephen Boulet
Does an arbitrary variable carry an attribute describing the text in its name? I'm looking for something along the lines of: x = 10 print x.name >>> 'x' Perhaps the x.__getattribute__ method? Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: Printing the name of a variable

2010-09-09 Thread Albert Hopkins
On Thu, 2010-09-09 at 12:43 -0700, Stephen Boulet wrote: > Does an arbitrary variable carry an attribute describing the text in > its name? I'm looking for something along the lines of: > > x = 10 > print x.name > >>> 'x' > > Perhaps the x.__getattribute__ method? Thanks. Variables are not objec

Why does linecache avoid ? How can I get equivalent of inspect.getsource() for an interactive session?

2010-09-09 Thread Mark Hirota
Here's my goal: To enable a function for interactive session use that, when invoked, will "put" source code for a specified object into a plaintext file. Based on some initial research, this seems similar to ipython's %save magic command (?) Example: def put(filename, object): f = open(filen

Re: SendKeys and Python 2.7

2010-09-09 Thread Michel Claveau - MVP
Hi! Example for send ^V (with PyWin32): import time,win32api,win32con win32api.keybd_event(win32con.VK_CONTROL, 0, 0, 0) win32api.keybd_event(ord('V'), 0, win32con.KEYEVENTF_EXTENDEDKEY | 0, 0) time.sleep(0.05) win32api.keybd_event(ord('V'), 0, win32con.KEYEVENTF_EXTENDEDKEY | win32c

Re: Difference between queues and pipes in multiprocessing

2010-09-09 Thread Nobody
On Thu, 09 Sep 2010 12:23:17 -0700, Ethan Furman wrote: >> basically a Queue is a syncronization primitive used to >> share and pass data to and from parent/child processes. >> >> A pipe is as the name suggests, a socket pair connected >> end-to-end allowing for full-duplex communications. >> >

Re: accessing a text file

2010-09-09 Thread Nobody
On Wed, 08 Sep 2010 03:30:00 -0700, Baba wrote: > Who is licensed to judge what can and cannot be posted as a question? Exactly the same set of people who are licensed to judge what can and cannot be posted as an answer. If you don't like the responses you get here, you could try posting your qu

Re: Catching a SIGSEGV signal on an import

2010-09-09 Thread Nobody
On Thu, 09 Sep 2010 05:23:14 -0700, Ryan wrote: > But, since SIGSEGV is asynchronous SIGSEGV is almost always synchronous. > In general, is there anyway to catch a SIGSEGV on import? No. If SIGSEGV is raised, it often indicates that memory has been corrupted. At that point, you can't assume th

Re: accessing a text file

2010-09-09 Thread Paul Rubin
Nobody writes: > If you don't like the responses you get here, you could try posting your > questions on 4chan. If nothing else, that will give you a whole new > perspective on what an "unfriendly" response really looks like. +1 QOTW -- http://mail.python.org/mailman/listinfo/python-list

analysis of algoritms

2010-09-09 Thread Baba
Hi In below code "the outer loop test in step 4 will execute ( n + 1 ) times (note that an extra step is required to terminate the for loop, hence n + 1 and not n executions), which will consume T4( n + 1 ) time." (from http://en.wikipedia.org/wiki/Analysis_of_algorithms) 1get a positive inte

Re: Printing the name of a variable

2010-09-09 Thread Terry Reedy
On 9/9/2010 3:43 PM, Stephen Boulet wrote: In Python, 'variable' is a synonym for name and identifier,' An object can have 0 to many names attached to it. An object can also be a member of 0 to many collections. Modules, classes, and functions have 'definition name' strings attached to them

how to kill a subprocess

2010-09-09 Thread cerr
Hi There, I'm calling a python script from a php script which again calls a perl script with subprocess.popen(). This seems to work fine so far only that once the python script completed it is becoming a zombie because the perl script in the background is still running... so before i exit the pyth

Re: analysis of algoritms

2010-09-09 Thread Almar Klein
On 9 September 2010 23:39, Baba wrote: > Hi > > In below code "the outer loop test in step 4 will execute ( n + 1 ) > times (note that an extra step is required to terminate the for loop, > hence n + 1 and not n executions), which will consume T4( n + 1 ) > time." (from http://en.wikipedia.org/wi

[ANN] ACCU 2011 Conference Call for Proposals -- deadline approaching

2010-09-09 Thread aspro
Hi all, This is a reminder that the deadline for the ACCU 2011 CfP is approaching fast--26th of September 2010. If you have not sent your proposals yet, below there are more details on how to do so. Call for Proposals - ACCU 2011 April 13-16, 2011. Barcelo Oxford Hotel, Oxford, UK Submission de

Re: analysis of algoritms

2010-09-09 Thread Robert Kern
On 9/9/10 4:39 PM, Baba wrote: Hi In below code "the outer loop test in step 4 will execute ( n + 1 ) times (note that an extra step is required to terminate the for loop, hence n + 1 and not n executions), which will consume T4( n + 1 ) time." (from http://en.wikipedia.org/wiki/Analysis_of_algo

Re: are there pros or contras, keeping a connection to a (sqlite) database ?

2010-09-09 Thread Gerhard Häring
On Thu, Sep 9, 2010 at 12:29 AM, CM wrote: > [...] > I'm not even sure what a "connection" really is; I assumed it was > nothing more than a rule that says to write to the database with the > file named in the parentheses. [...] The following list is not exclusive, but these are the first things

Re: are there pros or contras, keeping a connection to a (sqlite) database ?

2010-09-09 Thread CM
On Sep 9, 4:41 am, News123 wrote: > On 09/09/2010 12:29 AM, CM wrote: > > > On Sep 8, 1:09 pm, Stef Mientki wrote: > >>  hello, > > >> I wrap my database in some class, and on creation of the instance, a > >> connection to the database is > >> created, > >> and will stay connected until the prog

Re: Why does linecache avoid ? How can I get equivalent of inspect.getsource() for an interactive session?

2010-09-09 Thread Thomas Jollans
On Thursday 09 September 2010, it occurred to Mark Hirota to exclaim: > Here's my goal: > > To enable a function for interactive session use that, when invoked, > will "put" source code for a specified object into a plaintext file. > Based on some initial research, this seems similar to ipython's

Re: Queue cleanup

2010-09-09 Thread John Nagle
On 9/8/2010 6:20 PM, Paul Rubin wrote: What tricks on tricks? Even the fanciest GC's are orders of magnitude less complicated than any serious database, optimizing compiler, OS kernel, file system, etc. Real-world software is complicated. Get used to that fact, and look for ways to manage the

Re: analysis of algoritms

2010-09-09 Thread Alain Ketterlin
Baba writes: > In below code "the outer loop test in step 4 will execute ( n + 1 ) > times (note that an extra step is required to terminate the for loop, > hence n + 1 and not n executions), which will consume T4( n + 1 ) > time." (from http://en.wikipedia.org/wiki/Analysis_of_algorithms) > > 1

Re: analysis of algoritms

2010-09-09 Thread Dave Angel
On 2:59 PM, Baba wrote: Hi In below code "the outer loop test in step 4 will execute ( n + 1 ) times (note that an extra step is required to terminate the for loop, hence n + 1 and not n executions), which will consume T4( n + 1 ) time." (from http://en.wikipedia.org/wiki/Analysis_of_algorithms

Re: Difference between queues and pipes in multiprocessing

2010-09-09 Thread Ethan Furman
Nobody wrote: On Thu, 09 Sep 2010 12:23:17 -0700, Ethan Furman wrote: basically a Queue is a syncronization primitive used to share and pass data to and from parent/child processes. A pipe is as the name suggests, a socket pair connected end-to-end allowing for full-duplex communications. Isn

Re: how to kill a subprocess

2010-09-09 Thread Alain Ketterlin
cerr writes: > I'm calling a python script from a php script which again calls a perl > script with subprocess.popen(). > This seems to work fine so far only that once the python script > completed it is becoming a zombie because the perl script in the > background is still running... so before i

Re: how to kill a subprocess

2010-09-09 Thread cerr
On Sep 9, 3:29 pm, Alain Ketterlin wrote: > cerr writes: > > I'm calling a python script from a php script which again calls a perl > > script with subprocess.popen(). > > This seems to work fine so far only that once the python script > > completed it is becoming a zombie because the perl script

Re: how to kill a subprocess

2010-09-09 Thread MRAB
On 09/09/2010 23:52, cerr wrote: On Sep 9, 3:29 pm, Alain Ketterlin wrote: cerr writes: I'm calling a python script from a php script which again calls a perl script with subprocess.popen(). This seems to work fine so far only that once the python script completed it is becoming a zombie becau

Re: SendKeys and Python 2.7

2010-09-09 Thread Jakson A. Aquino
On Thu, Sep 9, 2010 at 5:40 PM, Michel Claveau - MVP wrote: > Hi! > > Example for send ^V  (with PyWin32): > >  import time,win32api,win32con >  win32api.keybd_event(win32con.VK_CONTROL, 0, 0, 0) >  win32api.keybd_event(ord('V'), 0, win32con.KEYEVENTF_EXTENDEDKEY | 0, 0) >  time.sleep(0.05) >  win

Re: analysis of algoritms

2010-09-09 Thread Wayne Brehaut
On Thu, 09 Sep 2010 18:26:52 -0400, Dave Angel wrote: > On 2:59 PM, Baba wrote: >> Hi >> >> In below code "the outer loop test in step 4 will execute ( n + 1 ) >> times (note that an extra step is required to terminate the for loop, >> hence n + 1 and not n executions), which will consume T4( n

reading multiple files

2010-09-09 Thread Mag Gam
I have 3 files which are constantly being updated therefore I use tail -f /var/log/file1, tail -f /var/log/file2, and tail -f /var/log/file3 For 1 file I am able to manage by tail -f /var/log/file1 | python prog.py prog.py looks like this: f=sys.stdin for line in f: print line But how can I ge

Re: how to kill a subprocess

2010-09-09 Thread Alain Ketterlin
cerr writes: >> x.terminate() (and then x.wait()) where x is the value returned by >> subprocess.Popen(). > Well, this is what I have: > > writelog("starting GPS simulator") > commandlist=[GPSsim,proto,GPSfile] > writelog(commandlist[0]+" "+commandlist[1]+" "+commandlist[2]) > process=sub

weighted mean; weighted standard error of the mean (sem)

2010-09-09 Thread C Barrington-Leigh
I am looking for some reaally basic statistical tools. I have some sample data, some sample weights for those measurements, and I want to calculate a mean and a standard error of the mean. Here are obvious places to look: numpy scipy.stats statsmodels It seems to me that numpy's "mean" and "aver

Re: Speed-up for loops

2010-09-09 Thread BartC
"Stefan Behnel" wrote in message news:mailman.563.1283921317.29448.python-l...@python.org... BartC, 08.09.2010 03:45: Getting back to the OP's code again (trivial and pointless as it might seem), I got these results: C (gcc 3.4.5 -O3) 0.8 secs C (DMC-o) 2.3 secs C (lccwin32 -O) 2.9 secs B

Re: reading multiple files

2010-09-09 Thread Alain Ketterlin
Mag Gam writes: > I have 3 files which are constantly being updated therefore I use tail > -f /var/log/file1, tail -f /var/log/file2, and tail -f /var/log/file3 > > For 1 file I am able to manage by > tail -f /var/log/file1 | python prog.py > > prog.py looks like this: > f=sys.stdin > for line in

Re: weighted mean; weighted standard error of the mean (sem)

2010-09-09 Thread Tim Leslie
On 10 September 2010 10:36, C Barrington-Leigh wrote: > > Most immediately, I'd love to get code for weighted sem. I'll write it > otherwise, but if I do I'd love to know whom to bug to get it > incorporated into numpy.sem ... The best place to ask about numpy related stuff is the numpy mailing l

How Python works: What do you know about support for negative indices?

2010-09-09 Thread Raymond Hettinger
Hello Folks. It doesn't seem to be common knowledge when and how a[x] gets translated to a[x+len(x)]. So, here's a short info post on how Python supports negative indices for sequences. I've put the answer below, but if you want to quickly test your own knowledge, ask yourself which of these sup

Re: weighted mean; weighted standard error of the mean (sem)

2010-09-09 Thread C Barrington-Leigh
> The best place to ask about numpy related stuff is the numpy mailing list at: > > http://mail.scipy.org/mailman/listinfo/numpy-discussion > > This is also the best place to present a patch if you have code to > contribute. In my experience the numpy devs are always happy to have > new contributo

Re: weighted mean; weighted standard error of the mean (sem)

2010-09-09 Thread Tim Leslie
On 10 September 2010 11:43, C Barrington-Leigh wrote: > >> The best place to ask about numpy related stuff is the numpy mailing list at: >> >> http://mail.scipy.org/mailman/listinfo/numpy-discussion >> >> This is also the best place to present a patch if you have code to >> contribute. In my exper

Re: Printing the name of a variable

2010-09-09 Thread Ben Finney
Albert Hopkins writes: > On Thu, 2010-09-09 at 12:43 -0700, Stephen Boulet wrote: > > Does an arbitrary variable carry an attribute describing the text in > > its name? > > Variables are not objects and so they have no attributes. Another way of thinking about is that there are no variables, onl

Re: How Python works: What do you know about support for negative indices?

2010-09-09 Thread Ben Finney
Raymond Hettinger writes: > It doesn't seem to be common knowledge when and how a[x] gets > translated to a[x+len(x)]. So, here's a short info post on how Python > supports negative indices for sequences. Thanks for this. Could you post your messages using a channel that doesn't arbitrarily spl

Re: reading multiple files

2010-09-09 Thread Mag Gam
Thanks for your response. I was going by this thread, http://mail.python.org/pipermail/tutor/2009-January/066101.html makes you wonder even if its possible. I will try your first solution by doing mkfifo on the files. On Thu, Sep 9, 2010 at 9:19 PM, Alain Ketterlin wrote: > Mag Gam writes:

Re: Printing the name of a variable

2010-09-09 Thread Mel
Stephen Boulet wrote: > Does an arbitrary variable carry an attribute describing the text in > its name? I'm looking for something along the lines of: > > x = 10 > print x.name 'x' > > Perhaps the x.__getattribute__ method? Thanks. Hmm. "Recent scholarship suggests that the Iliad and the

Re: How Python works: What do you know about support for negativeindices?

2010-09-09 Thread Mark Tolonen
"Ben Finney" wrote in message news:874ody9w3v@benfinney.id.au... Raymond Hettinger writes: It doesn't seem to be common knowledge when and how a[x] gets translated to a[x+len(x)]. So, here's a short info post on how Python supports negative indices for sequences. Thanks for this. Cou

Re: How Python works: What do you know about support for negativeindices?

2010-09-09 Thread Neil Hodgson
Mark Tolonen: > It came across fine for me (on much maligned Outlook Express, no less). Yes, looks fine to me both in Thunderbird (news, not mailing list) and at Google Groups. There is a single text part with all lines except an URL easily within 80 columns. Perhaps there is a problem in Ben'