Re: Queue cleanup

2010-09-04 Thread Paul Rubin
Dennis Lee Bieber writes: > Not to mention having to ensure that one finds ALL the references to > the object so that they can be updated to the new address! Somehow I > don't see a C compiler being smart enough to find intermediary pointer We're not talking about C compilers, which can cas

Re: Financial time series data

2010-09-04 Thread Frederic Rentsch
On Fri, 2010-09-03 at 19:58 +0200, Virgil Stokes wrote: > import urllib2 > import re > > def get_SP500_symbolsX (): > symbols = [] > lsttradestr = re.compile('Last Trade:') > k = 0 > for page in range(10): >url = 'http://finance.yahoo.com/q/cp?s=%5EGSPC&c='+str(page) >

Re: Financial time series data

2010-09-04 Thread Toomore
I write some object for Taiwan Stock ... http://github.com/toomore/goristock But still dev ... On Sep 3, 1:12 am, Virgil Stokes wrote: >   Has anyone written code or worked with Python software for downloading > financial time series data (e.g. from Yahoo financial)? If yes,  would you > please

Re: IDLE / Black frame on Mac

2010-09-04 Thread Kristoffer Føllesdal
On Sep 4, 5:19 am, Ned Deily wrote: > In article > , >  Kristoffer Follesdal wrote: > > > *Forgot to tell that I am using a Mac with Snow Leopard. > > Which version of Python 3.1.2?  From the python.org installer?   > MacPorts?  Built from source - if so, which version of Tk? > > -- >  Ned Deily,

pyla: python little algorithms

2010-09-04 Thread atronoush
Dear all, pyla stands for Python Little Algorithm is a project in pure Python and includes simple, easy to use, yet powerful libraries for - 2D/3D plotting using Gnuplot - Matrix/Vector operations - ODE solvers - Optimization and nonlinear algebraic equation solvers - ... Homepage: pyla home is:

Re: Queue cleanup

2010-09-04 Thread Aahz
[gc] In article <7x7hj2kyd6@ruckus.brouhaha.com>, Paul Rubin wrote: > >A minimal naive implementation indeed doubles the memory requirements, >but from a Python perspective where every integer takes something like >24 bytes already, even that doesn't seem so terrible. Many people still us

Re: String substitution VS proper mysql escaping

2010-09-04 Thread Aahz
In article , =?UTF-8?B?zp3Or866zr/Pgg==?= wrote: > >After all () used to define tuples and [] usedd to define lists. Why >commas? No, "()" does *not* define tuples, except for the empty tuple. The comma defines tuples, with parentheses simply used for visual effect: >>> 1, 2, 3 (1, 2, 3) -- A

State Machines in Python

2010-09-04 Thread Jack Keegan
Hi girls & guys, Just joined the group. I'm new to Python but been picking it up pretty easy. I love it! I'm hoping to use it to make a controlling application for an experiment. Basically I want to use it to interface with some data acquisition (DAQ) hardware to accept incoming signals and respon

Re: State Machines in Python

2010-09-04 Thread D'Arcy J.M. Cain
On Sat, 4 Sep 2010 14:36:38 +0100 Jack Keegan wrote: > Just joined the group. I'm new to Python but been picking it up pretty easy. Welcome aboard. > As there is no switch statement in Python, I've been looking around for a > good implementation. Most of the algorithms I've come across seem to b

Re: State Machines in Python

2010-09-04 Thread Stefan Behnel
Jack Keegan, 04.09.2010 15:36: Hi girls& guys, Just joined the group. I'm new to Python but been picking it up pretty easy. I love it! Welcome to the group. I'm hoping to use it to make a controlling application for an experiment. Basically I want to use it to interface with some data acqu

Re: State Machines in Python

2010-09-04 Thread Stef Mientki
On 04-09-2010 15:36, Jack Keegan wrote: > Hi girls & guys, > > Just joined the group. I'm new to Python but been picking it up pretty easy. > I love it! I'm hoping > to use it to make a controlling application for an experiment. Basically I > want to use it to > interface with some data acquisit

Re: Installation problem: Python 2.6.6 (32-Bit) on Windows 7 (32-Bit)

2010-09-04 Thread Martin v. Loewis
Am 01.09.2010 21:18, schrieb Cappy2112: > Has anyone else had problems running the msi for Python 2.6.6 on > Windows 7 Professional? I specifically tested whether "compile .py" works before the release, and it worked fine on my machine. I suspect you have a source file on your disk that it tries

Re: what is this kind of string: b'string' ?

2010-09-04 Thread Martin v. Loewis
Am 01.09.2010 23:32, schrieb Stef Mientki: > in winpdb I see strings like this: > a = b'string' a > 'string' type(a) > > > what's the "b" doing in front of the string ? It's redundant. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: what is this kind of string: b'string' ?

2010-09-04 Thread Stefan Behnel
Martin v. Loewis, 04.09.2010 18:52: Am 01.09.2010 23:32, schrieb Stef Mientki: in winpdb I see strings like this: >>> a = b'string' >>> a 'string' >>> type(a) what's the "b" doing in front of the string ? It's redundant. Not completely. (I know that you know this, but to those who don't

Re: what is this kind of string: b'string' ?

2010-09-04 Thread Martin v. Loewis
Am 04.09.2010 19:27, schrieb Stefan Behnel: > Martin v. Loewis, 04.09.2010 18:52: >> Am 01.09.2010 23:32, schrieb Stef Mientki: >>> in winpdb I see strings like this: >>> >>> >>> a = b'string' >>> >>> a >>> 'string' >>> >>> type(a) >>> >>> >>> what's the "b" doing in front of the string ? >> >>

Re: State Machines in Python

2010-09-04 Thread Roy Smith
In article , "D'Arcy J.M. Cain" wrote: > On Sat, 4 Sep 2010 14:36:38 +0100 > Jack Keegan wrote: > > Just joined the group. I'm new to Python but been picking it up pretty easy. > > Welcome aboard. > > > As there is no switch statement in Python, I've been looking around for a > > good impleme

Re: State Machines in Python

2010-09-04 Thread MRAB
On 04/09/2010 18:58, Roy Smith wrote: In article, "D'Arcy J.M. Cain" wrote: On Sat, 4 Sep 2010 14:36:38 +0100 Jack Keegan wrote: Just joined the group. I'm new to Python but been picking it up pretty easy. Welcome aboard. As there is no switch statement in Python, I've been looking aro

Error in Following python program

2010-09-04 Thread Pramod
#/usr/bin/python from numpy import matrix n=input('Enter matrix range') fr=open('mat.txt','r') print ('Enter elements into the matrix\n') a=matrix([[input()for j in range(n)] for i in range(n)]) for i in range(n): for j in range(n): print a[i][j] print '\n' When i r

Re: State Machines in Python

2010-09-04 Thread D'Arcy J.M. Cain
On Sat, 04 Sep 2010 13:58:00 -0400 Roy Smith wrote: > > while True: > > state = state(data) > > This is the pattern I've always used. Simple and effective for any > state machine which is small enough to code by hand. I generally have > my state methods return (next_state, output) tuples,

Re: State Machines in Python

2010-09-04 Thread D'Arcy J.M. Cain
On Sat, 04 Sep 2010 19:13:28 +0100 MRAB wrote: > I suppose that if they are that similar then you could generate the > code from a list or table of the states. They generally aren't as simple as the little example script that I cobbled together. -- D'Arcy J.M. Cain | Democracy is thre

Re: Error in Following python program

2010-09-04 Thread MRAB
On 04/09/2010 19:28, Pramod wrote: #/usr/bin/python from numpy import matrix n=input('Enter matrix range') fr=open('mat.txt','r') print ('Enter elements into the matrix\n') a=matrix([[input()for j in range(n)] for i in range(n)]) for i in range(n): for j in range(n): pri

Re: State Machines in Python

2010-09-04 Thread Stefan Behnel
D'Arcy J.M. Cain, 04.09.2010 20:30: On Sat, 04 Sep 2010 13:58:00 -0400 Roy Smith wrote: while True: state = state(data) This is the pattern I've always used. Simple and effective for any state machine which is small enough to code by hand. I generally have my state methods return (next

Re: Error in Following python program

2010-09-04 Thread Peter Otten
Pramod wrote: > #/usr/bin/python > from numpy import matrix > n=input('Enter matrix range') > fr=open('mat.txt','r') > print ('Enter elements into the matrix\n') > a=matrix([[input()for j in range(n)] for i in range(n)]) > for i in range(n): > for j in range(n): > print a[i

Re: State Machines in Python

2010-09-04 Thread Roy Smith
In article , "D'Arcy J.M. Cain" wrote: > On Sat, 04 Sep 2010 13:58:00 -0400 > Roy Smith wrote: > > > while True: > > > state = state(data) > > > > This is the pattern I've always used. Simple and effective for any > > state machine which is small enough to code by hand. I generally have

Re: Queue cleanup

2010-09-04 Thread Paul Rubin
Lawrence D'Oliveiro writes: > That reinforces my point, about how easy it was to check the correctness of > the code. In this case one simple fix, like this ... > would render the code watertight. See how easy it is? Well, no, it's irrelevant how easy it is to fix the issue after it's pointed ou

Re: Queue cleanup

2010-09-04 Thread John Nagle
On 8/28/2010 5:42 AM, Aahz wrote: In article<4c78572c$0$28655$c3e8...@news.astraweb.com>, Steven D'Aprano wrote: On Fri, 27 Aug 2010 09:16:52 -0700, Aahz wrote: In article, MRAB wrote: An object will be available for garbage collection when nothing refers to it either directly or indirectl

the script is failing without a useful report

2010-09-04 Thread nvictor
hi all, need your help. i get a traceback that doesn't tell much about the actual error in my code: Traceback (most recent call last): File ".\eightqueens.py", line 32, in generate(n, x, col, up, down) File ".\eightqueens.py", line 17, in generate else: generate(n, x, col, up, down)

Re: the script is failing without a useful report

2010-09-04 Thread MRAB
On 04/09/2010 22:22, nvictor wrote: hi all, need your help. i get a traceback that doesn't tell much about the actual error in my code: Traceback (most recent call last): File ".\eightqueens.py", line 32, in generate(n, x, col, up, down) File ".\eightqueens.py", line 17, in generate

Re: the script is failing without a useful report

2010-09-04 Thread nvictor
thank you so much. -- http://mail.python.org/mailman/listinfo/python-list

Re: Speed-up for loops

2010-09-04 Thread Gabriele Lanaro
Maybe for the simple sum you can just use the sum builtin: python -m timeit -s 'sum((10,)*1)' 1000 loops, best of 3: 0.0985 usec per loop About the loop in general it's a good practice to use list comprehension and generator expressions 2010/9/2 Michael Kreim > Hi, > > I was comparing

Question about Reading Files

2010-09-04 Thread genxtech
Hello. I am still really new to python and I have a project where I am trying to use the data files from another program and write a new program with new user interface and all. My first step was to open one of the files in 'rb' mode and print the contents, but I am unfamiliar with the format. H

Re: Question about Reading Files

2010-09-04 Thread genxtech
I forgot to mention that the output was the first 100 bytes of the output -- http://mail.python.org/mailman/listinfo/python-list

Re: Question about Reading Files

2010-09-04 Thread Mats Rauhala
On 2010-09-04, genxtech wrote: > Hello. I am still really new to python and I have a project where I > am trying to use the data files from another program and write a new > program with new user interface and all. My first step was to open > one of the files in 'rb' mode and print the contents,

Re: Question about Reading Files

2010-09-04 Thread MRAB
On 05/09/2010 00:04, genxtech wrote: Hello. I am still really new to python and I have a project where I am trying to use the data files from another program and write a new program with new user interface and all. My first step was to open one of the files in 'rb' mode and print the contents,

Re: Question about Reading Files

2010-09-04 Thread genxtech
On Sep 4, 7:23 pm, Mats Rauhala wrote: > On 2010-09-04, genxtech wrote: > > > Hello.  I am still really new to python and I have a project where I > > am trying to use the data files from another program and write a new > > program with new user interface and all.  My first step was to open > > o

Re: Queue cleanup

2010-09-04 Thread Lawrence D'Oliveiro
In message , MRAB wrote: > Lawrence D'Oliveiro writes: >> >> Wonder why Sun’s licence explicitly forbade its use in danger-critical >> areas like nuclear power plants and the like, then? > > I thought it was just that if it wasn't explicitly forbidden then > someone might try to use it and then

Re: Queue cleanup

2010-09-04 Thread Lawrence D'Oliveiro
In message <4c82b097$0$1661$742ec...@news.sonic.net>, John Nagle wrote: > Personally, I'd like to have reference counting only, an enforced > prohibition on loops (backpointers must be weak pointers), RAII, > and reliably ordered finalization. Is there a cheap way of checking at runtime for c

Re: Queue cleanup

2010-09-04 Thread Lawrence D'Oliveiro
In message <7x7hj2kyd6@ruckus.brouhaha.com>, Paul Rubin wrote: > Lawrence D'Oliveiro writes: > >> In message <7xmxs2uez1@ruckus.brouhaha.com>, Paul Rubin wrote: >> >>> GC's for large systems generally don't free (or even examine) individual >>> garbage objects. They copy the live objects

Re: Queue cleanup

2010-09-04 Thread Paul Rubin
Lawrence D'Oliveiro writes: >> A minimal naive implementation indeed doubles the memory requirements, >> but from a Python perspective where every integer takes something like >> 24 bytes already, even that doesn't seem so terrible. > > Doubling 24 is less terrible than doubling 4 or 8?? You’re ki

Network and socket programming in python

2010-09-04 Thread shivram
i want to learn network and socket programming but i would like to do this in python.Reason behind this is that python is very simple and the only language i know . anybody can suggest me which book should i pick. the book should have following specification-- 1)not tedious to follow 2)lots of exam

Re: Queue cleanup

2010-09-04 Thread John Nagle
On 9/4/2010 6:44 PM, Lawrence D'Oliveiro wrote: In message<4c82b097$0$1661$742ec...@news.sonic.net>, John Nagle wrote: Personally, I'd like to have reference counting only, an enforced prohibition on loops (backpointers must be weak pointers), RAII, and reliably ordered finalization. Is

Subclassing by monkey-patching

2010-09-04 Thread Jason
I'm attempting to implement a recursive directory monitor based on the GIO file monitor in PyGTK. My approach is basically to take the gio.FileMonitor returned by the method gio.File.monitor_directory(), connect to the "changed" signal, and add or remove monitors on create/ delete events for subdir

Re: Speed-up for loops

2010-09-04 Thread David Cournapeau
On Thu, Sep 2, 2010 at 7:02 PM, Michael Kreim wrote: > Hi, > > I was comparing the speed of a simple loop program between Matlab and > Python. > > My Codes: > $ cat addition.py > imax = 10 > a = 0 > for i in xrange(imax): >    a = a + 10 > print a > > $ cat addition.m > imax = 1e9; > a = 0

Re: Queue cleanup

2010-09-04 Thread Paul Rubin
John Nagle writes: > Unoptimized reference counting, which is what CPython does, isn't > all that great either. The four big bottlenecks in Python are boxed > numbers, attribute lookups, reference count updates, and the GIL. The performance hit of having to lock the refcounts before update h