Re: How can I make this piece of code even faster?

2013-07-21 Thread Peter Otten
pablobarhamal...@gmail.com wrote: > Ok, I'm working on a predator/prey simulation, which evolve using genetic > algorithms. At the moment, they use a quite simple feed-forward neural > network, which can change size over time. Each brain "tick" is performed > by the following function (inside the

Re: How can I make this piece of code even faster?

2013-07-21 Thread Serhiy Storchaka
20.07.13 23:22, pablobarhamal...@gmail.com написав(ла): e = math.e count = -1 for x in range(hidden_num): temp = 0 for y in range(input_num): count += 1 temp += inputs[y] * h_weight[count] hidden[

Re: How can I make this piece of code even faster?

2013-07-21 Thread Paul Rudin
Steven D'Aprano writes: > On Sat, 20 Jul 2013 13:22:03 -0700, pablobarhamalzas asked: > > "How can I make this piece of code even faster?" > > - Use a faster computer. > - Put in more memory. > - If using Unix or Linux, decrease the "nice" priority of the process. > > I mention these because some

Re: How can I make this piece of code even faster?

2013-07-21 Thread Christian Gollwitzer
How about using numpy? Am 20.07.13 22:22, schrieb pablobarhamal...@gmail.com: Ok, I'm working on a predator/prey simulation, which evolve using genetic algorithms. At the moment, they use a quite simple feed-forward neural network, which can change size over time. Each brain "tick" is performe

Re: Find and Replace Simplification

2013-07-21 Thread Serhiy Storchaka
20.07.13 20:03, Joshua Landau написав(ла): Still, it seems to me that it should be optimizable for sensible builtin types such that .translate is significantly faster, as there's no theoretical extra work that .translate *has* to do that .replace does not, and .replace also has to rebuild the str

Re: How can I make this piece of code even faster?

2013-07-21 Thread Chris Angelico
On Sun, Jul 21, 2013 at 5:11 PM, Paul Rudin wrote: > Steven D'Aprano writes: > >> On Sat, 20 Jul 2013 13:22:03 -0700, pablobarhamalzas asked: >> >> "How can I make this piece of code even faster?" >> >> - Use a faster computer. >> - Put in more memory. >> - If using Unix or Linux, decrease the "n

Re: How can I make this piece of code even faster?

2013-07-21 Thread pablobarhamalzas
Thank's for all the replies! I've tried some of the imporovements you suggested (using math.exp() and sum() or math.fsum()). None of that made the code faster, because they are functions you are calling lots of times, and function calling is quite time expensive (same as x**(1/2) is faster than

Re: How can I make this piece of code even faster?

2013-07-21 Thread Steven D'Aprano
On Sun, 21 Jul 2013 03:19:24 -0700, pablobarhamalzas wrote: > Thank's for all the replies! I've tried some of the imporovements you > suggested (using math.exp() and sum() or math.fsum()). None of that made > the code faster, because they are functions you are calling lots of > times, and function

Re: How can I make this piece of code even faster?

2013-07-21 Thread Chris Angelico
On Sun, Jul 21, 2013 at 8:31 PM, Steven D'Aprano wrote: > On Sun, 21 Jul 2013 03:19:24 -0700, pablobarhamalzas wrote: > >> Thank's for all the replies! I've tried some of the imporovements you >> suggested (using math.exp() and sum() or math.fsum()). None of that made >> the code faster, because t

Re: How can I make this piece of code even faster?

2013-07-21 Thread pablobarhamalzas
El domingo, 21 de julio de 2013 12:31:42 UTC+2, Steven D'Aprano escribió: > On Sun, 21 Jul 2013 03:19:24 -0700, pablobarhamalzas wrote: > > > > > Thank's for all the replies! I've tried some of the imporovements you > > > suggested (using math.exp() and sum() or math.fsum()). None of that made

Re: Beginner - GUI devlopment in Tkinter - Any IDE with drag and drop feature like Visual Studio?

2013-07-21 Thread Dave Cook
On 2013-07-20, Aseem Bansal wrote: > Do I need to use QtCreator with PySide if I want drag-and-drop > feature for GUI development? No, you just need the layout part of QtCreator, called QtDesigner, and any decent Python editor or IDE (e.g. Idle): http://wiki.python.org/moin/IntegratedDevelopme

Re: Beginner - GUI devlopment in Tkinter - Any IDE with drag and drop feature like Visual Studio?

2013-07-21 Thread Chris “Kwpolska” Warrick
On Sun, Jul 21, 2013 at 1:14 PM, Dave Cook wrote: > On 2013-07-20, Aseem Bansal wrote: > >> Do I need to use QtCreator with PySide if I want drag-and-drop >> feature for GUI development? > > No, you just need the layout part of QtCreator, called QtDesigner, and > any decent Python editor or IDE (

Re: Find and Replace Simplification

2013-07-21 Thread Joshua Landau
On 21 July 2013 08:44, Serhiy Storchaka wrote: > 20.07.13 20:03, Joshua Landau написав(ла): > >> Still, it seems to me that it should be optimizable for sensible >> builtin types such that .translate is significantly faster, as there's >> no theoretical extra work that .translate *has* to do that

Re: How can I make this piece of code even faster?

2013-07-21 Thread Joshua Landau
On 20 July 2013 21:22, wrote: > Ok, I'm working on a predator/prey simulation, which evolve using genetic > algorithms. At the moment, they use a quite simple feed-forward neural > network, which can change size over time. Each brain "tick" is performed by > the following function (inside the

Re: Find and Replace Simplification

2013-07-21 Thread Serhiy Storchaka
21.07.13 14:29, Joshua Landau написав(ла): On 21 July 2013 08:44, Serhiy Storchaka wrote: 20.07.13 20:03, Joshua Landau написав(ла): Still, it seems to me that it should be optimizable for sensible builtin types such that .translate is significantly faster, as there's no theoretical extra wor

Re: How can I make this piece of code even faster?

2013-07-21 Thread Stefan Behnel
pablobarhamal...@gmail.com, 21.07.2013 12:48: > El domingo, 21 de julio de 2013 12:31:42 UTC+2, Steven D'Aprano escribió: >> [steve@ando ~]$ python3.3 -m timeit -s "x = 2.357e7" "x**0.5" >> 100 loops, best of 3: 0.319 usec per loop >> [steve@ando ~]$ python3.3 -m timeit -s "x = 2.357e7" -s "fr

Re: Find and Replace Simplification

2013-07-21 Thread Joshua Landau
On 21 July 2013 13:28, Serhiy Storchaka wrote: > 21.07.13 14:29, Joshua Landau написав(ла): > >> On 21 July 2013 08:44, Serhiy Storchaka wrote: >>> >>> 20.07.13 20:03, Joshua Landau написав(ла): >>> Still, it seems to me that it should be optimizable for sensible builtin types such that

Re: Play Ogg Files

2013-07-21 Thread Stefan Behnel
Devyn Collier Johnson, 20.07.2013 14:25: > On 07/20/2013 12:21 AM, Stefan Behnel wrote: >> Devyn Collier Johnson, 20.07.2013 03:06: >>> I am making a chatbot that I host on Launchpad.net/neobot. I am currently >>> converting the engine from BASH code to Python3. I need to convert this for >>> cross

Simple Python script as SMTP server for outgoing e-mails?

2013-07-21 Thread Gilles
Hello Every once in a while, my ISP's SMTP server refuses to send perfectly legit e-mails because it considers them as SPAM. So I'd like to install a dead-simple SMTP server on my XP computer just to act as SMTP backup server. All I'd need is to change the SMTP address in my e-mail client

Re: Simple Python script as SMTP server for outgoing e-mails?

2013-07-21 Thread Chris Angelico
On Mon, Jul 22, 2013 at 12:42 AM, Gilles wrote: > Hello > > Every once in a while, my ISP's SMTP server refuses to send > perfectly legit e-mails because it considers them as SPAM. > > So I'd like to install a dead-simple SMTP server on my XP computer > just to act as SMTP backup server. >

Re: How can I make this piece of code even faster?

2013-07-21 Thread Michael Torrie
On 07/21/2013 04:19 AM, pablobarhamal...@gmail.com wrote: > Thank's for all the replies! I've tried some of the imporovements you > suggested (using math.exp() and sum() or math.fsum()). > None of that made the code faster, because they are functions you are calling > lots of times, and function

Re: Simple Python script as SMTP server for outgoing e-mails?

2013-07-21 Thread Gilles
On Mon, 22 Jul 2013 00:48:29 +1000, Chris Angelico wrote: >Rather than write something from scratch, I'd look at deploying >something out-of-the-box - Postfix, for instance - which you will be >able to configure much faster than writing your own. And then you >could have it either send via your IS

Re: Simple Python script as SMTP server for outgoing e-mails?

2013-07-21 Thread Michael Torrie
On 07/21/2013 10:19 AM, Gilles wrote: > So, does someone know of a good, SMTP server just to send e-mails? What you're looking for is not an SMTP server but a Mail Transfer Agent, called an MTA. Pretty much all distros ship with an MTA by default, even if the SMTP server part of it isn't installe

Re: Simple Python script as SMTP server for outgoing e-mails?

2013-07-21 Thread Gilles
On Sun, 21 Jul 2013 11:46:52 -0600, Michael Torrie wrote: >What you're looking for is not an SMTP server but a Mail Transfer Agent, >called an MTA. > >Pretty much all distros ship with an MTA by default, even if the SMTP >server part of it isn't installed or running. And often the MTA is, for >com

Homework help requested, thanks to everyone.

2013-07-21 Thread John Ladasky
Thanks to everyone for their wealth of suggestions. I already had my students playing with turtle. And I had asked them to alphabetize a string (without having previously revealed the sorted() function). So far, I have taken up the suggestion of the number-guessing game. One of my students h

Re: Simple Python script as SMTP server for outgoing e-mails?

2013-07-21 Thread Ivan Shmakov
> Gilles writes: > On Sun, 21 Jul 2013 11:46:52 -0600, Michael Torrie wrote: [Cross-posting to news:comp.mail.misc.] >> What you're looking for is not an SMTP server but a Mail Transfer >> Agent, called an MTA. [...] >> Dennis is correct, though, that most ISPs do block out

Re: Simple Python script as SMTP server for outgoing e-mails?

2013-07-21 Thread Grant Edwards
On 2013-07-21, Gilles wrote: > Every once in a while, my ISP's SMTP server refuses to send > perfectly legit e-mails because it considers them as SPAM. > > So I'd like to install a dead-simple SMTP server on my XP computer > just to act as SMTP backup server. All I'd need is to change the SMTP >

Re: Beginner - GUI devlopment in Tkinter - Any IDE with drag and drop feature like Visual Studio?

2013-07-21 Thread Dave Cook
On 2013-07-21, Chris “Kwpolska” Warrick wrote: > …and one more thing: pyside-uic, for transforming the .ui files into > (ugly) .py files. It seems to be in /PythonXY/Scripts according to > Stack Overflow if you have PySide installed. Also, it looks like it's possible to directly load the .ui fi

Re: Homework help requested, thanks to everyone.

2013-07-21 Thread Chris Angelico
On Mon, Jul 22, 2013 at 6:49 AM, John Ladasky wrote: > Another project I thought of was a Pig Latin translator. (But do kids today > even know what Pig Latin is? Am I showing my age?) Even if they don't, they'll grok it no problem. It's simple enough. ChrisA -- http://mail.python.org/mailma

Re: Simple Python script as SMTP server for outgoing e-mails?

2013-07-21 Thread Michael Torrie
On 07/21/2013 02:34 PM, Gilles wrote: > Thanks for the infos. Ideally, I was looking for a simple Windows app > as MTA, but a Python script is OK. The Sendmail MTA has been ported to many platforms including windows. But... > I'm not sure my ISP blocks outbound port 25 connections. I'll > experim

Re: Homework help requested, thanks to everyone.

2013-07-21 Thread Roy Smith
In article , Chris Angelico wrote: > On Mon, Jul 22, 2013 at 6:49 AM, John Ladasky > wrote: > > Another project I thought of was a Pig Latin translator. (But do kids > > today even know what Pig Latin is? Am I showing my age?) > > > Even if they don't, they'll grok it no problem. It's simp

Re: Beginner - GUI devlopment in Tkinter - Any IDE with drag and drop feature like Visual Studio?

2013-07-21 Thread fronagzen
On Saturday, July 20, 2013 3:59:00 PM UTC+8, Aseem Bansal wrote: > After considering all the options suggested here I decided to use > PySide/QtCreator as was suggested by Dave Cook. I created a simple GUI with > QtCreator and found a way to convert .ui files to .py files. So far so good. > > Bu

RE: Homework help requested, thanks to everyone.

2013-07-21 Thread Joseph Clark
John, have you taken a look at pyglet? It's an alternative to pygame and I found it pretty slick once I got the hang of it. There is a development version that's compatible with python 3 and I've never had a bug with it. It wraps OpenGL itself so there are no additional dependencies. // jo

Re: Beginner - GUI devlopment in Tkinter - Any IDE with drag and drop feature like Visual Studio?

2013-07-21 Thread Michael Torrie
On 07/21/2013 05:20 AM, Chris “Kwpolska” Warrick wrote: > On Sun, Jul 21, 2013 at 1:14 PM, Dave Cook wrote: >> On 2013-07-20, Aseem Bansal wrote: >> >>> Do I need to use QtCreator with PySide if I want drag-and-drop >>> feature for GUI development? >> >> No, you just need the layout part of QtCre