very simple Genetic Algorithm completed

Matthew_WARREN at bnpparibas.com Matthew_WARREN at bnpparibas.com
Fri Feb 1 11:13:03 EST 2008








On Feb 1, 9:11 am, Matthew_WAR... at bnpparibas.com wrote:
>
> > 0. Tack this bit onto the end of quickga.py, and you wont have to
> > write a separate routine to import quickga and invoke evolve():
> >
> > >     if __name__ == "__main__":
> > >         evolve()
> >
> > I hear you, but something I dont tend to do as I use pythons
interactive
> > prompt a lot, and I like things not autorunning when I import them. I
> > normally add it in at the end of writing something.
> >
>
> Not to fear!  The test 'if __name__ == "__main__":' guards against
> running this code when the module is imported.  The following code is
> run *only* if the module is invoked directly, as in "python
> quickga.py".
>
> This way, test or demonstration code can be included right with your
> library module, and it wont get run when the module is imported.  It
> really is a good idiom to learn, whether you use the interactive
> prompt a lot or not.

Heh, that's what I get for assuming it did what I thought and ignoring
it...

Matt.




This message and any attachments (the "message") is
intended solely for the addressees and is confidential. 
If you receive this message in error, please delete it and 
immediately notify the sender. Any use not in accord with 
its purpose, any dissemination or disclosure, either whole 
or partial, is prohibited except formal approval. The internet
can not guarantee the integrity of this message. 
BNP PARIBAS (and its subsidiaries) shall (will) not 
therefore be liable for the message if modified. 
Do not print this message unless it is necessary,
consider the environment.

                ---------------------------------------------

Ce message et toutes les pieces jointes (ci-apres le 
"message") sont etablis a l'intention exclusive de ses 
destinataires et sont confidentiels. Si vous recevez ce 
message par erreur, merci de le detruire et d'en avertir 
immediatement l'expediteur. Toute utilisation de ce 
message non conforme a sa destination, toute diffusion 
ou toute publication, totale ou partielle, est interdite, sauf 
autorisation expresse. L'internet ne permettant pas 
d'assurer l'integrite de ce message, BNP PARIBAS (et ses
filiales) decline(nt) toute responsabilite au titre de ce 
message, dans l'hypothese ou il aurait ete modifie.
N'imprimez ce message que si necessaire,
pensez a l'environnement.



More information about the Python-list mailing list