Re: Calculating very large exponents in python

2010-03-07 Thread Taskinoor Hasan
First of all, you simply can't use this straight approach of primality testing for very very big numbers. There are a number of algorithms, both deterministic and random. Please Google for them (and don't forget to check Wikipedia too). Study the random algorithms to check whether they can be appli

Re: running a program on many processors

2010-03-07 Thread Stefan Behnel
Martin P. Hellwig, 08.03.2010 03:08: I did read, two years or so ago, that AMD was looking in to something that does just what you say on a cpu level, that is present itself as one logical cpu but underneath there are multiple physical ones. I wouldn't hold my breath though waiting for it. Many

Re: A "scopeguard" for Python

2010-03-07 Thread Alf P. Steinbach
* Gabriel Genellina: En Thu, 04 Mar 2010 20:52:04 -0300, Alf P. Steinbach escribió: Sorry, as with the places noted above, I can't understand what you're trying to say here. Regarding your posts, neither can I. All the time. Sorry, deciphering your posts would force me to spend much more t

RE: Calculating very large exponents in python

2010-03-07 Thread Fahad Ahmad
Thanks Geremy, That has been an absolute bump... GOD i cant sit on my chair, it has worked even on 512 bit number and with no time.. superb i would say. lastly, i am using the code below to calculate Largest Prime factor of a number: print ('''=

Re: The C language like the Python, by the Python and for the Python --- PythoidC

2010-03-07 Thread Stefan Behnel
CHEN Guang, 08.03.2010 06:08: Hi, if you are interested in C-Python mixed programming, please take a look at: http://pythoidc.googlecode.com PythoidC is the C language like the Python, by the Python and for the Python It looks a bit dangerous to me to parse C header files only with regular exp

Re: negative "counts" in collections.Counter?

2010-03-07 Thread Raymond Hettinger
On Mar 7, 5:46 pm, Steven D'Aprano wrote: > Given that Counter supports negative counts, it looks to me that the > behaviour of __add__ and __sub__ is fundamentally flawed. You should > raise a bug report (feature enhancement) on the bug tracker. It isn't a bug. I designed it that way. There wer

The C language like the Python, by the Python and for the Python --- PythoidC

2010-03-07 Thread CHEN Guang
Hi, if you are interested in C-Python mixed programming, please take a look at: http://pythoidc.googlecode.com PythoidC is the C language like the Python, by the Python and for the Python import c c.include(c.h.stdio) c.include(c.h.stdlib) '''Annotation is free!''' int fib(int n): if(n<=2

Evaluating Income Property

2010-03-07 Thread satish groups
Income property is becoming more attractive to investors looking for a better return on their money. With today's low interest rates, income- producing properties such as apartments and duplexes can produce exciting returns. As with any type of property, the value of income property is what someone

Re: Reverse engineering CRC?

2010-03-07 Thread Steven D'Aprano
On Mon, 08 Mar 2010 16:09:12 +1300, Gregory Ewing wrote: > Given some known data/crc pairs, how feasible is it to figure out the > polynomial being used to generate the crc? Google is your friend: http://www.woodmann.com/fravia/crctut1.htm -- Steven -- http://mail.python.org/mailman/listinf

Re: Reverse engineering CRC?

2010-03-07 Thread Steven D'Aprano
On Mon, 08 Mar 2010 16:09:12 +1300, Gregory Ewing wrote: > Given some known data/crc pairs, how feasible is it to figure out the > polynomial being used to generate the crc? Can you just ask the application developer what CRC is being used? Or look at the source code? Disassemble the binary? >

Re: IMAP mail filters tool

2010-03-07 Thread python
Ken, Check out Zed Shaw's very cool Lamson project. http://lamsonproject.org/ Malcolm - Original message - From: "Ken Seehart" To: python-list@python.org Date: Thu, 04 Mar 2010 21:33:26 -0800 Subject: IMAP mail filters tool I'm thinking of possibly making a simple client-agnostic tool f

[ANNC] pynguin-0.2 (python turtle graphics application)

2010-03-07 Thread Lee Harr
Pynguin is a python-based turtle graphics application.     It combines an editor, interactive interpreter, and     graphics display area. It is meant to be an easy environment for introducing     some programming concepts to beginning programmers. http://pynguin.googlecode.com/ This release c

Reverse engineering CRC?

2010-03-07 Thread Gregory Ewing
Given some known data/crc pairs, how feasible is it to figure out the polynomial being used to generate the crc? In the case I'm looking at, it appears that the crc size may be at least 24 bits, so just trying all possible polynomials probably isn't doable. An article I found hints at the possib

Re: write to remote ile

2010-03-07 Thread Martin P. Hellwig
On 03/08/10 02:51, monkeys paw wrote: On 3/7/2010 9:20 PM, Martin P. Hellwig wrote: On 03/08/10 02:10, monkeys paw wrote: I can xfer a file from a remote server using: import urllib2 as u x=u.urlopen('http://tycho.usno.navy.mil/cgi-bin/timer.pl') for line in x: print line How can i write a

Re: write to remote ile

2010-03-07 Thread monkeys paw
On 3/7/2010 9:20 PM, Martin P. Hellwig wrote: On 03/08/10 02:10, monkeys paw wrote: I can xfer a file from a remote server using: import urllib2 as u x=u.urlopen('http://tycho.usno.navy.mil/cgi-bin/timer.pl') for line in x: print line How can i write a file to the remote server? I tried: x

Curiosity stirkes me on 'import this'.

2010-03-07 Thread Xavier Ho
I took a look at the 'this' module to see where the file is stored. This is probably old news to some people, but was new to me. print this.s Gur Mra bs Clguba, ol Gvz Crgref Ornhgvshy vf orggre guna htyl. Rkcyvpvg vf orggre guna vzcyvpvg. Fvzcyr vf orggre guna pbzcyrk. Pbzcyrk vf orggre guna pbz

Best practice way to detect internet connectivity under Python 2.6/Windows

2010-03-07 Thread python
Is the best pratice way to detect internet connectivity under Windows (using Python 2.6) simply to attempt to access a known internet website using urllib or urlib2 wrapped in a try/except construct? Thank you, Malcolm -- http://mail.python.org/mailman/listinfo/python-list

Call for papers: SETP-10, USA, July 2010

2010-03-07 Thread James Heralds
It would be highly appreciated if you could share this announcement with your colleagues, students and individuals whose research is in software engineering, software testing, software quality assurance, software design and related areas. Call for papers: SETP-10, USA, July 2010 The 2010 Internat

Re: write to remote ile

2010-03-07 Thread Martin P. Hellwig
On 03/08/10 02:10, monkeys paw wrote: I can xfer a file from a remote server using: import urllib2 as u x=u.urlopen('http://tycho.usno.navy.mil/cgi-bin/timer.pl') for line in x: print line How can i write a file to the remote server? I tried: x = u.url.open('http://joemoney.net/somefile.txt

write to remote ile

2010-03-07 Thread monkeys paw
I can xfer a file from a remote server using: import urllib2 as u x=u.urlopen('http://tycho.usno.navy.mil/cgi-bin/timer.pl') for line in x: print line How can i write a file to the remote server? I tried: x = u.url.open('http://joemoney.net/somefile.txt', 'w') but that does not work --

Re: running a program on many processors

2010-03-07 Thread Martin P. Hellwig
On 03/08/10 00:18, Paweł Banyś wrote: Hello, I have already read about Python and multiprocessing which allows using many processors. The idea is to split a program into separate tasks and run each of them on a separate processor. However I want to run a Python program doing a single simple task

Re: A "scopeguard" for Python

2010-03-07 Thread Gabriel Genellina
En Thu, 04 Mar 2010 20:52:04 -0300, Alf P. Steinbach escribió: Sorry, as with the places noted above, I can't understand what you're trying to say here. Regarding your posts, neither can I. All the time. Sorry, deciphering your posts would force me to spend much more time than available

Re: negative "counts" in collections.Counter?

2010-03-07 Thread Steven D'Aprano
On Sun, 07 Mar 2010 22:21:27 +, Arnaud Delobelle wrote: > Vlastimil Brom writes: > >> Hi all, >> I'd like to ask about the possibility of negative "counts" in >> collections.Counter (using Python 3.1); I believe, my usecase is rather >> trivial, basically I have the word frequencies of two t

Re: best practices: is collections.defaultdict my friend or not?

2010-03-07 Thread Steven D'Aprano
On Sun, 07 Mar 2010 09:33:22 +, Mark Lawrence wrote: >> I was a little frightened of doing "import this" ("Hey, kid, run rm - >> rf / and see what happens!"), but did, and the words are wise. >> >> Pete > > After reading the words of wisdom try "import this" a second time and > watch what ha

Re: running a program on many processors

2010-03-07 Thread Steven D'Aprano
On Mon, 08 Mar 2010 01:18:13 +0100, Paweł Banyś wrote: > Hello, > > I have already read about Python and multiprocessing which allows using > many processors. The idea is to split a program into separate tasks and > run each of them on a separate processor. However I want to run a Python > progra

Re: running a program on many processors

2010-03-07 Thread Gib Bogle
Paweł Banyś wrote: ... How can it be achieved? Very carefully. -- http://mail.python.org/mailman/listinfo/python-list

Re: running a program on many processors

2010-03-07 Thread Diez B. Roggisch
Am 08.03.10 01:18, schrieb Paweł Banyś: Hello, I have already read about Python and multiprocessing which allows using many processors. The idea is to split a program into separate tasks and run each of them on a separate processor. However I want to run a Python program doing a single simple ta

running a program on many processors

2010-03-07 Thread Paweł Banyś
Hello, I have already read about Python and multiprocessing which allows using many processors. The idea is to split a program into separate tasks and run each of them on a separate processor. However I want to run a Python program doing a single simple task on many processors so that their cumula

Re: NoSQL Movement?

2010-03-07 Thread floaiza
I don't think there is any doubt about the value of relational databases, particularly on the Internet. The issue in my mind is how to leverage all the information that resides in the "deep web" using strictly the relational database paradigm. Because that paradigm imposes a tight and rigid coupli

Window crash/freeze after "python test.py" in \Gnuplot

2010-03-07 Thread gujax
Hi, My computer OS is Win ME, and I am running a Py2.5 version. Gnuplot is v4.2, Gnuplot_py is v1.8. However, whenever I give a command "python test.py" to test Gnuplot_py, I sometimes get message " #Gnuplot.for enjoyment #press return to open a window >.. >clear terminal #t

Re: time_struct

2010-03-07 Thread moerchendiser2k3
any ideas? -- http://mail.python.org/mailman/listinfo/python-list

Re: killing own process in windows

2010-03-07 Thread News123
Hi Cristian, Christian Heimes wrote: > News123 wrote: >> Hi, >> >> >> How can I kill my own process? >> >> Some multithreaded programs, that I have are unable to stop when ctrl-C >> is pressed. >> Some can't be stopped with sys.exit() > > You have to terminate the XMP-RPC server or the manager fi

Re: killing own process in windows

2010-03-07 Thread Christian Heimes
News123 wrote: > Hi, > > > How can I kill my own process? > > Some multithreaded programs, that I have are unable to stop when ctrl-C > is pressed. > Some can't be stopped with sys.exit() You have to terminate the XMP-RPC server or the manager first. Check the docs! You can terminate a Python

Re: killing own process in windows

2010-03-07 Thread Martin P. Hellwig
On 03/07/10 21:54, News123 wrote: Hi Martin. Hellwig wrote: On 03/07/10 21:08, News123 wrote: Hi, How can I kill my own process? Some multithreaded programs, that I have are unable to stop when ctrl-C is pressed. Some can't be stopped with sys.exit() So I'd just like to terminate my own pro

Re: negative "counts" in collections.Counter?

2010-03-07 Thread Arnaud Delobelle
Vlastimil Brom writes: > Hi all, > I'd like to ask about the possibility of negative "counts" in > collections.Counter (using Python 3.1); > I believe, my usecase is rather trivial, basically I have the word > frequencies of two texts and I want do compare them (e.g. to see what > was added and r

Re: killing own process in windows

2010-03-07 Thread News123
Hi Martin. Hellwig wrote: > On 03/07/10 21:08, News123 wrote: >> Hi, >> >> >> How can I kill my own process? >> >> Some multithreaded programs, that I have are unable to stop when ctrl-C >> is pressed. >> Some can't be stopped with sys.exit() >> >> So I'd just like to terminate my own program. >> >

Re: stopping a multiprocessing.managers.BaseManager nicely (looks like a hack)

2010-03-07 Thread News123
My fix has certain problems: News123 wrote: > Hi, > > > I have following program > > from multiprocessing.managers import BaseManager > def myfunc(): return 3 > class MyManager(BaseManager): pass > MyManager.register('myfunc',callable = myfunc) > m = MyManager(address=('127.0.0.1', 5),authk

Re: killing own process in windows

2010-03-07 Thread Martin P. Hellwig
On 03/07/10 21:08, News123 wrote: Hi, How can I kill my own process? Some multithreaded programs, that I have are unable to stop when ctrl-C is pressed. Some can't be stopped with sys.exit() So I'd just like to terminate my own program. Examples of non killable (not killable with CTRL-C) pr

stopping a multiprocessing.managers.BaseManager nicely (looks like a hack)

2010-03-07 Thread News123
Hi, I have following program from multiprocessing.managers import BaseManager def myfunc(): return 3 class MyManager(BaseManager): pass MyManager.register('myfunc',callable = myfunc) m = MyManager(address=('127.0.0.1', 5),authkey='abracadabra') server = m.get_server() server.serve_forever(

killing own process in windows

2010-03-07 Thread News123
Hi, How can I kill my own process? Some multithreaded programs, that I have are unable to stop when ctrl-C is pressed. Some can't be stopped with sys.exit() So I'd just like to terminate my own program. Examples of non killable (not killable with CTRL-C) programs: - A program, that started an

negative "counts" in collections.Counter?

2010-03-07 Thread Vlastimil Brom
Hi all, I'd like to ask about the possibility of negative "counts" in collections.Counter (using Python 3.1); I believe, my usecase is rather trivial, basically I have the word frequencies of two texts and I want do compare them (e.g. to see what was added and removed between different versions of

Bluetooth

2010-03-07 Thread PythonAB
Hello, I'm writing a script that has to connect a bluetooth device with a 3D application. On my search for a bluetooth module i ran into this: http://www.python.org/download/releases/2.4/notes/ where it says: "The socket module now supports Bluetooth sockets, if the system has " Yet I can't find

Re: Calculating very large exponents in python

2010-03-07 Thread geremy condra
On Sun, Mar 7, 2010 at 1:55 PM, Fahad Ahmad wrote: > Dear All, > > i am writing my crytographic scheme in python, i am just a new user to it. > I have written the complete code, the only point i am stuck it is that i am > using 256 exponentiation which is normal in crytography but python just > ha

Re: Duplicate keys in dict?

2010-03-07 Thread Tim Chase
vsoler wrote: On 7 mar, 17:53, Steven D'Aprano wrote: On Sun, 07 Mar 2010 08:23:13 -0800, vsoler wrote: Hello, My code snippet reads data from excel ranges. First row and first column are column headers and row headers respectively. After reding the range I build a dict. 'A'...

Calculating very large exponents in python

2010-03-07 Thread Fahad Ahmad
Dear All, i am writing my crytographic scheme in python, i am just a new user to it. I have written the complete code, the only point i am stuck it is that i am using 256 exponentiation which is normal in crytography but python just hangs on it. g**x [where both g and x are 256 bit numbers ,

click me

2010-03-07 Thread madhan
please clic it it will be usefull to you http://123maza.com/78/healthyfitness/ -- http://mail.python.org/mailman/listinfo/python-list

importerror: module Gnuplot missing

2010-03-07 Thread gujax
Hi, I need help. I am trying to follow examples from a book "Python Scripting for Computational Science" and the examples are all plotted using Gnuplot. When I run the programs I get error saying "importerror Gnuplot module missing". I have installed Gnuplot in C:\My Programs\gnuplot directory (ru

Re: a simple def how-to

2010-03-07 Thread Stefan Behnel
vsoler, 07.03.2010 16:05: Hello, My script starts like this: book=readFromExcelRange('book') house=readFromExcelRange('house') table=readFromExcelRange('table') read=readFromExcelRange('read') ... But I would like to have something equivalent, like... ranges=['book','house','table','read'] fo

Re: Duplicate keys in dict?

2010-03-07 Thread vsoler
On 7 mar, 17:53, Steven D'Aprano wrote: > On Sun, 07 Mar 2010 08:23:13 -0800, vsoler wrote: > > Hello, > > > My code snippet reads data from excel ranges. First row and first column > > are column headers and row headers respectively. After reding the range > > I build a dict. > > > ..

Re: Duplicate keys in dict?

2010-03-07 Thread Steven D'Aprano
On Sun, 07 Mar 2010 08:23:13 -0800, vsoler wrote: > Hello, > > My code snippet reads data from excel ranges. First row and first column > are column headers and row headers respectively. After reding the range > I build a dict. > > 'A'..'B' > 'ab'3

Re: Duplicate keys in dict?

2010-03-07 Thread News123
vsoler wrote: > Hello, > > My code snippet reads data from excel ranges. First row and first > column are column headers and row headers respectively. After reding > the range I build a dict. > > 'A'..'B' > 'ab'35 > 'cd'7

Re: a simple def how-to

2010-03-07 Thread Steven D'Aprano
On Sun, 07 Mar 2010 07:05:26 -0800, vsoler wrote: > Hello, > > My script starts like this: > > book=readFromExcelRange('book') > house=readFromExcelRange('house') > table=readFromExcelRange('table') > read=readFromExcelRange('read') > ... > > But I would like to have something equivalent, like.

Duplicate keys in dict?

2010-03-07 Thread vsoler
Hello, My code snippet reads data from excel ranges. First row and first column are column headers and row headers respectively. After reding the range I build a dict. 'A'..'B' 'ab'35 'cd'72 'cd'9.

Re: a simple def how-to

2010-03-07 Thread John Posner
On 3/7/2010 10:59 AM, vsoler wrote: Thank you for your help. Perhaps the solution you are suggesting is not exactly what I was looking for, but helped anyway. Oops, I was thinking list, not dict. Too fast, and not enough coffee! -John -- http://mail.python.org/mailman/listinfo/python-list

Re: a simple def how-to

2010-03-07 Thread vsoler
On 7 mar, 16:23, John Posner wrote: > On 3/7/2010 10:05 AM, vsoler wrote: > > > > > Hello, > > > My script starts like this: > > > book=readFromExcelRange('book') > > house=readFromExcelRange('house') > > table=readFromExcelRange('table') > > read=readFromExcelRange('read') > > ... > > > But I wou

Re: a simple def how-to

2010-03-07 Thread vsoler
On 7 mar, 16:23, Andreas Waldenburger wrote: > On Sun, 7 Mar 2010 07:05:26 -0800 (PST) vsoler > > > > wrote: > > Hello, > > > My script starts like this: > > > book=readFromExcelRange('book') > > house=readFromExcelRange('house') > > table=readFromExcelRange('table') > > read=readFromExcelRange('

Re: a simple def how-to

2010-03-07 Thread John Posner
On 3/7/2010 10:05 AM, vsoler wrote: Hello, My script starts like this: book=readFromExcelRange('book') house=readFromExcelRange('house') table=readFromExcelRange('table') read=readFromExcelRange('read') ... But I would like to have something equivalent, like... ranges=['book','house','table',

Re: a simple def how-to

2010-03-07 Thread Andreas Waldenburger
On Sun, 7 Mar 2010 07:05:26 -0800 (PST) vsoler wrote: > Hello, > > My script starts like this: > > book=readFromExcelRange('book') > house=readFromExcelRange('house') > table=readFromExcelRange('table') > read=readFromExcelRange('read') > ... > > But I would like to have something equivalent,

Re: compiler with python

2010-03-07 Thread Mark Lawrence
Alf and Steven Howe, please don't top post, it makes it all but impossible to follow a thread. Darn!:) Mark Lawrence. Alf P. Steinbach wrote: Since Mohamed is talking about compilation I think it's more likely he's talking about an intermediate program represention based on quad tuples like

a simple def how-to

2010-03-07 Thread vsoler
Hello, My script starts like this: book=readFromExcelRange('book') house=readFromExcelRange('house') table=readFromExcelRange('table') read=readFromExcelRange('read') ... But I would like to have something equivalent, like... ranges=['book','house','table','read'] for i in ranges: var[i]=re

Re: Asynchronous HTTP client

2010-03-07 Thread exarkun
On 02:40 pm, ping.nsr@gmail.com wrote: 2010/3/7 On 06:53 am, ping.nsr@gmail.com wrote: Hi, I'm trying to find a way to create an asynchronous HTTP client so I can get responses from web servers in a way like async_http_open('http://example.com/', callback_func) # immediately contin

Re: compiler with python

2010-03-07 Thread Stefan Behnel
mohamed issolah, 06.03.2010 14:07: I want to create a compiler which transform a code like pascal code (that what I do in C) to "quad" In C, I use BISON and FLEX tools. Hi, please stop starting new threads for the same topic. Instead, reply to responses you get. Stefan -- http://mail.pytho

Re: Asynchronous HTTP client

2010-03-07 Thread pingooo
2010/3/7 > On 06:53 am, ping.nsr@gmail.com wrote: > >> Hi, >> >> I'm trying to find a way to create an asynchronous HTTP client so I >> can get responses from web servers in a way like >> >> async_http_open('http://example.com/', callback_func) >> # immediately continues, and callback_func

Re: Problem with regular expression

2010-03-07 Thread Paul McGuire
On Mar 7, 4:32 am, Joan Miller wrote: > I would to convert the first string to upper case. But this regular > expression is not matching the first string between quotes. > Is using pyparsing overkill? Probably. But your time is valuable, and pyparsing let's you knock this out in less time than i

time_struct

2010-03-07 Thread moerchendiser2k3
Hi, can anyone tell me how to return a time_struct from the timemodule in my own C-Module? Is that possible? I can just find one function in timefuncs.h, but it doesnt return any PyObject. Thanks in advance. moerchendiser2k3 -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem with regular expression

2010-03-07 Thread Tim Chase
Joan Miller wrote: I would to convert the first string to upper case. But this regular expression is not matching the first string between quotes. re.sub("'(?P\w+)': [^{]", "\gFOO", str) Well, my first thought is that you're not using raw strings, so you're not using the regexps and replace

Re: Asynchronous HTTP client

2010-03-07 Thread Lie Ryan
On 03/07/2010 05:53 PM, Ping wrote: > Hi, > > I'm trying to find a way to create an asynchronous HTTP client so I > can get responses from web servers in a way like > > async_http_open('http://example.com/', callback_func) > # immediately continues, and callback_func is called with response >

Re: Asynchronous HTTP client

2010-03-07 Thread exarkun
On 06:53 am, ping.nsr@gmail.com wrote: Hi, I'm trying to find a way to create an asynchronous HTTP client so I can get responses from web servers in a way like async_http_open('http://example.com/', callback_func) # immediately continues, and callback_func is called with response as arg w

Re: Problem with regular expression

2010-03-07 Thread Steve Holden
Joan Miller wrote: > I would to convert the first string to upper case. But this regular > expression is not matching the first string between quotes. > > re.sub("'(?P\w+)': [^{]", "\gFOO", str) > > # string to non-matching > 'foo': { > > # strings to matching > 'bar': 'bar2' > 'bar': None > '

Re: Problem with regular expression

2010-03-07 Thread News123
Hi Joan, Joan Miller wrote: > I would to convert the first string to upper case. But this regular > expression is not matching the first string between quotes. > > re.sub("'(?P\w+)': [^{]", "\gFOO", str) > > # string to non-matching > 'foo': { > > # strings to matching > 'bar': 'bar2' > 'ba

Re: Conditional based on whether or not a module is being used

2010-03-07 Thread Steve Holden
Vinay Sajip wrote: [...] > Well, the logging package is available in Python and ready for use and > pretty much battle tested, so why not use that? Are you planning to > use third-party libraries in your Python work, or write everything > yourself? If you are planning to use third party libraries,

Problem with regular expression

2010-03-07 Thread Joan Miller
I would to convert the first string to upper case. But this regular expression is not matching the first string between quotes. re.sub("'(?P\w+)': [^{]", "\gFOO", str) # string to non-matching 'foo': { # strings to matching 'bar': 'bar2' 'bar': None 'bar': 0 'bar': True So, i.e., from the fir

Re: best practices: is collections.defaultdict my friend or not?

2010-03-07 Thread Mark Lawrence
Pete Emerson wrote: On Mar 5, 6:10 pm, Andreas Waldenburger wrote: On Fri, 5 Mar 2010 17:22:14 -0800 (PST) Pete Emerson wrote: [snip] data['one'] = {} data['one']['two'] = 'three' print data {'one': {'two': 'three'}} And through some research, I discovered collections.defaultdict (new