Re: announcing: dmangame: an ai game. maybe.

2011-06-05 Thread James Mills
On Mon, Jun 6, 2011 at 3:50 PM, okay zed wrote: > the link: http://okayzed.github.com/dmangame/introduction.html > > dmangame is a game about writing AI for a simple strategy game. > > an example game: > http://okayzed.github.com/dmangame/circleblaster_vs_expand.html This is really cool. I haven

Re: how to avoid leading white spaces

2011-06-05 Thread ru...@yahoo.com
On 06/03/2011 08:05 PM, Steven D'Aprano wrote: > On Fri, 03 Jun 2011 12:29:52 -0700, ru...@yahoo.com wrote: > I often find myself changing, for example, a startwith() to a RE when I realize that the input can contain mixed case >>> >>> Why wouldn't you just normalise the case? >> >> Becau

announcing: dmangame: an ai game. maybe.

2011-06-05 Thread okay zed
the link: http://okayzed.github.com/dmangame/introduction.html dmangame is a game about writing AI for a simple strategy game. an example game: http://okayzed.github.com/dmangame/circleblaster_vs_expand.html there are some example / more advanced AI in the dmanai repository (http://github.com/ok

Re: how to avoid leading white spaces

2011-06-05 Thread ru...@yahoo.com
On 06/03/2011 03:45 PM, Chris Torek wrote: >>On 2011-06-03, ru...@yahoo.com wrote: > [prefers] >>> re.split ('[ ,]', source) > > This is probably not what you want in dealing with > human-created text: > > >>> re.split('[ ,]', 'foo bar, spam,maps') > ['foo', '', 'bar', '', 'spam', 'map

Re: how to avoid leading white spaces

2011-06-05 Thread ru...@yahoo.com
On 06/03/2011 02:49 PM, Neil Cerutti wrote: > > On 2011-06-03, ru...@yahoo.com wrote: or that I have to treat commas as well as spaces as delimiters. >>> >>> >>> >>> source.replace(",", " ").split(" ") >> >> >> >> Uhgg. create a whole new string just so you can split it on one

Re: float("nan") in set or as key

2011-06-05 Thread Chris Angelico
On Mon, Jun 6, 2011 at 2:59 PM, Steven D'Aprano wrote: > On Mon, 06 Jun 2011 14:11:03 +1000, Chris Angelico wrote: >> So does this mean that: >> (with signalling NANs) should trap on the second line but not the first? BTW, by "should" I meant "would if Python's float were 100% IEEE-754 compliant"

Re: float("nan") in set or as key

2011-06-05 Thread Steven D'Aprano
On Mon, 06 Jun 2011 14:11:03 +1000, Chris Angelico wrote: > On Mon, Jun 6, 2011 at 11:21 AM, Steven D'Aprano > wrote: >> The intended behaviour is operations on "quiet NANs" should return >> NANs, but operations on "signalling NANs" should cause a trap, which >> can either be ignored, and convert

Re: CGI: remove variable from Tuple Object query

2011-06-05 Thread Chris Rebert
On Sun, Jun 5, 2011 at 8:55 PM, Gnarlodious wrote: > Say I send a request like this: > http://0.0.0.0/Sectrum/Gnomon?see=Gnomon&order=7&epoch=1303541219 > > This makes for a CGIform of the CGI Tuple Object type: > FieldStorage(None, None, [MiniFieldStorage('see', 'Gnomon'), > MiniFieldStorage('ord

Re: float("nan") in set or as key

2011-06-05 Thread Chris Angelico
On Mon, Jun 6, 2011 at 11:21 AM, Steven D'Aprano wrote: > The intended behaviour is operations on "quiet NANs" should return NANs, > but operations on "signalling NANs" should cause a trap, which can either > be ignored, and converted into a quiet NAN, or treated as an exception. > > E.g. in Decim

CGI: remove variable from Tuple Object query

2011-06-05 Thread Gnarlodious
Say I send a request like this: http://0.0.0.0/Sectrum/Gnomon?see=Gnomon&order=7&epoch=1303541219 This makes for a CGIform of the CGI Tuple Object type: FieldStorage(None, None, [MiniFieldStorage('see', 'Gnomon'), MiniFieldStorage('order', '7'), MiniFieldStorage('epoch', '1303541219.58')]) So the

Re: Has anyone seen any updated versions of pywapi? (Python Weather API)

2011-06-05 Thread Benjamin Schollnick
Because there was several issues that suggested they were incorporating weather underground support, which I am having trouble with... Can't seem to get the weather underground forecast feed to process correctly with their model. I have hacked in element tree but it's not quite right... And I

Re: Has anyone seen any updated versions of pywapi? (Python Weather API)

2011-06-05 Thread Brian Curtin
On Sun, Jun 5, 2011 at 19:27, Benjamin Schollnick < bscholln...@schollnick.net> wrote: > The Google Code site is at http://code.google.com/p/python-weather-api/ > > And it's powerful, but I don't see any updates since late 2010... Does > anyone know of a different pre-built API for accessing weat

Re: float("nan") in set or as key

2011-06-05 Thread Chris Torek
>> On Mon, Jun 6, 2011 at 8:54 AM, Chris Torek wrote: >>> A signalling NaN traps at (more or less -- details vary depending on >>> FPU architecture) load time. >On Mon, 06 Jun 2011 09:13:25 +1000, Chris Angelico wrote: >> Load. By this you mean the operation of taking a bit-pattern in RAM and >>

Re: float("nan") in set or as key

2011-06-05 Thread Steven D'Aprano
On Mon, 06 Jun 2011 09:13:25 +1000, Chris Angelico wrote: > On Mon, Jun 6, 2011 at 8:54 AM, Chris Torek wrote: >> A signalling NaN traps at (more or less -- details vary depending on >> FPU architecture) load time. > > Load. By this you mean the operation of taking a bit-pattern in RAM and > put

Re: float("nan") in set or as key

2011-06-05 Thread Steven D'Aprano
On Sun, 05 Jun 2011 19:15:02 +0100, Nobody wrote: > On Sun, 05 Jun 2011 07:21:10 +, Steven D'Aprano wrote: > >> Returning a sentinel meaning "an exceptional event occurred" is hardly >> unusual, even in Python. str.find() does is, as does re.search() and >> re.match(). > > These are not "exc

Re: Programmer font

2011-06-05 Thread James Mills
On Mon, Jun 6, 2011 at 9:57 AM, Ben Finney wrote: > Operating systems where programmers get to make decisions generally > don't have this problem :-) Using GNOME on Debian, the default Monospace > font has underscores which show as distinct characters separated by a > small gap. On my desktop at

Has anyone seen any updated versions of pywapi? (Python Weather API)

2011-06-05 Thread Benjamin Schollnick
The Google Code site is at http://code.google.com/p/python-weather-api/ And it's powerful, but I don't see any updates since late 2010... Does anyone know of a different pre-built API for accessing weather information? - Benjamin -- http://mail.python.org/mailman/listinfo/python-list

Re: Generator Frustration

2011-06-05 Thread TommyVee
"Gregory Ewing" wrote in message news:95059efur...@mid.individual.net... Steven D'Aprano wrote: A nice piece of syntax that has been proposed for Python is "yield from", which will do the same thing, but you can't use that yet. Unless you're impatient enough to compile your own Python with m

Re: Programmer font

2011-06-05 Thread Ben Finney
Den writes: > As we all know, python uses underlines and double underlines as > significant characters. But fonts, including programmers' fonts, > generally design underlines to run together. Operating systems where programmers get to make decisions generally don't have this problem :-) Using

Programmer font

2011-06-05 Thread Den
As we all know, python uses underlines and double underlines as significant characters. But fonts, including programmers' fonts, generally design underlines to run together. This makes it hard to identify single from double, or double from triple underlines (at least for me). I have modified th

Re: float("nan") in set or as key

2011-06-05 Thread Chris Angelico
On Mon, Jun 6, 2011 at 8:54 AM, Chris Torek wrote: > A signalling NaN traps at (more or less -- details vary depending > on FPU architecture) load time. Load. By this you mean the operation of taking a bit-pattern in RAM and putting it into a register? So, you can calculate 0/0, get a signalling

Re: Multiple windows services on the same machine

2011-06-05 Thread Ben Finney
Massi writes: > So can anyone point me out which is the best way to "parametrize" the > service name? Thanks in advance for your help! Could you not make the ‘_svc_display_name’ an instance attribute instead of class attribute? That is, don't set it as an attribute on the class; instead, set it

Re: float("nan") in set or as key

2011-06-05 Thread Chris Torek
In article Chris Angelico wrote: >Uhh, noob question here. I'm way out of my depth with hardware >floating point. > >Isn't a signaling nan basically the same as an exception? Not exactly, but one could think of them as "very similar". Elsethread, someone brought up the key distinction, which i

Small Problem with Weather Underground XML API...

2011-06-05 Thread Benjamin Schollnick
I am working scraping the Weather Underground using the XML interface... I am hoping to to add this into the pywapi, but that looks like it's been abandoned? I haven't seen any updates in ages to it... And I'm using the Weather Underground XML API (http://wiki.wunderground.com/index.php/API_

Re: float("nan") in set or as key

2011-06-05 Thread Robert Kern
On 6/4/11 9:03 PM, Steven D'Aprano wrote: On Sat, 04 Jun 2011 16:49:40 -0500, Robert Kern wrote: Steven is being a little hyperbolic. Python does not fully conform to all of the details of the IEEE-754 specification, though it does conform to most of them. I'm not sure that "most" is correct,

Re: Standard Deviation One-liner

2011-06-05 Thread Ethan Furman
Steven D'Aprano wrote: On Fri, 03 Jun 2011 13:09:43 -0700, Raymond Hettinger wrote: On Jun 3, 10:55 am, Billy Mays wrote: I'm trying to shorten a one-liner I have for calculating the standard deviation of a list of numbers. I have something so far, but I was wondering if it could be made any

Re: Lambda question

2011-06-05 Thread Terry Reedy
On 6/5/2011 5:31 AM, Alain Ketterlin wrote: writes: f = lambda x, n, acc=[]: f(x[n:], n, acc+[(x[:n])]) if x else acc f=lambda ... statements are inferior for practical purposes to the equivalent def f statements because the resulting object is missing a useful name attribute and a docstr

Re: float("nan") in set or as key

2011-06-05 Thread Nobody
On Sun, 05 Jun 2011 07:21:10 +, Steven D'Aprano wrote: > Returning a sentinel meaning "an exceptional event occurred" is hardly > unusual, even in Python. str.find() does is, as does re.search() and > re.match(). These are not "exceptional" conditions; if they were, an exception would be us

Re: Standard Deviation One-liner

2011-06-05 Thread Steven D'Aprano
On Fri, 03 Jun 2011 13:09:43 -0700, Raymond Hettinger wrote: > On Jun 3, 10:55 am, Billy Mays wrote: >> I'm trying to shorten a one-liner I have for calculating the standard >> deviation of a list of numbers.  I have something so far, but I was >> wondering if it could be made any shorter (withou

Multiple windows services on the same machine

2011-06-05 Thread Massi
Hi everyone, I'm writing a script which implement a windows service with the win32serviceutil module. The service works perfectly, but now I would need to install several instances of the same service on my machine for testing purpose. This is hard since the service name is hard-coded in the servic

Re: How to stop iteration

2011-06-05 Thread Shashank Singh
You can modify your code to stop trying to split the 'remaining part' when the 'remaining part' is too small def strsplit(stri, spa): if len(stri) <= spa: final_result.append(stri) return s = stri[:spa] final_result.append(s) stri = stri[spa:] strsplit(stri,spa

Re: How to stop iteration

2011-06-05 Thread Nitin Pawar
check length of input string with if stri.len > 3 On Sun, Jun 5, 2011 at 8:35 PM, Ganapathy Subramanium < sganapathy.subraman...@gmail.com> wrote: > Hi All, > > I'm a new bie to programming and need some assistance in this code. > > I have a function which will split the given string into 3 chara

How to stop iteration

2011-06-05 Thread Ganapathy Subramanium
Hi All, I'm a new bie to programming and need some assistance in this code. I have a function which will split the given string into 3 characters each and I want to achieve this by recursion. I have written the following code, but I don't know how to stop the recursion when the length of the rem

Re: Lambda question

2011-06-05 Thread John Posner
On 2:59 PM, Ian Kelly wrote: > On Sat, Jun 4, 2011 at 12:09 PM, Chris Angelico wrote: >> Python doesn't seem to have an inbuilt function to divide strings in >> this way. At least, I can't find it (except the special case where n >> is 1, which is simply 'list(string)'). Pike allows you to use the

Re: Distutils beginner question - windows

2011-06-05 Thread Mark Hammond
On 3/06/2011 6:57 PM, Seb S wrote: Hi all, Just a quick question , I have a simple script I want to convert into a windows installer and give to some friends. I had a look at http://docs.python.org/distutils/introduction.html and wrote this setup script: #!/usr/bin/env python from distuti

Re: Something is rotten in Denmark...

2011-06-05 Thread Jussi Piitulainen
rusi writes: > On Jun 5, 5:03 pm, Jussi Piitulainen wrote: > > rusi writes: > > > On Jun 3, 11:17 am, Jussi Piitulainen wrote: > > > > rusi writes: > > > > > So I tried: > > > > > Recast the comprehension as a map > > > > > Rewrite the map into a fmap (functionalmap) to create new bindings > > > >

Re: A simple way to print few line stuck to the same position

2011-06-05 Thread Hans Mulder
On 5/06/11 05:40:17, Sarcar, Shourya C (GE Healthcare) wrote: A way to do this on DOS/Windows console would be: import sys for r in range(0,2**16): line = "Count : %d" % r sys.stdout.write(line) sys.stdout.flush() # do something that consumes time backup =

EARN

2011-06-05 Thread shah shaheen
EARN MONEY AT HOME HOW TO EARN MONEY WITH THIS SITE TO PTC SITE THEY PAID YOU ONLY VIEW AD'S CONTACT ME MY email...karimabdul7...@gmail.com CLIXSENSE = http://www.clixsense.com/?3278319&jun12 NEOBUX == http://www.neobux.com/?r=shahjee5

Re: Something is rotten in Denmark...

2011-06-05 Thread rusi
On Jun 5, 5:03 pm, Jussi Piitulainen wrote: > rusi writes: > > On Jun 3, 11:17 am, Jussi Piitulainen wrote: > > > rusi writes: > > > > So I tried: > > > > Recast the comprehension as a map > > > > Rewrite the map into a fmap (functionalmap) to create new bindings > > > > > def fmap(f,lst): > > > >

Re: Something is rotten in Denmark...

2011-06-05 Thread Jussi Piitulainen
rusi writes: > On Jun 3, 11:17 am, Jussi Piitulainen wrote: > > rusi writes: > > > So I tried: > > > Recast the comprehension as a map > > > Rewrite the map into a fmap (functionalmap) to create new bindings > > > > > def fmap(f,lst): > > >     if not lst: return [] > > >     return [f(lst[0])] + f

Re: how to avoid leading white spaces

2011-06-05 Thread rusi
On Jun 3, 7:25 pm, Steven D'Aprano wrote: > Regarding their syntax, I'd like to point out that even Larry Wall is > dissatisfied with regex culture in the Perl community: > > http://www.perl.com/pub/2002/06/04/apo5.html This is a very good link. And it can be a starting point for python to leapf

Re: Something is rotten in Denmark...

2011-06-05 Thread rusi
On Jun 3, 11:17 am, Jussi Piitulainen wrote: > rusi writes: > > So I tried: > > Recast the comprehension as a map > > Rewrite the map into a fmap (functionalmap) to create new bindings > > > def fmap(f,lst): > >     if not lst: return [] > >     return [f(lst[0])] + fmap(f, lst[1:]) > > > Still th

We wholesale Amazon Kindle/ Monster Beats / Ipods / Apple products of all types

2011-06-05 Thread sdgsad
hi We wholesale Amazon Kindle/ Monster Beats / Ipods / Apple products of all types Apple iPad 2 16GB WiFi 450$ Apple iPad 2 32GB WiFi580$ Apple iPad 2 64GB WiFi 620$ iPad 2 16GB Wi-Fi+3G Verizon/AT&T 550$ iPad 2 32GB Wi-Fi+3G Verizon/AT&T 650$ iPad 2 64GB Wi-Fi+3G Verizon/AT&T 750

Re: python + php encrypt/decrypt

2011-06-05 Thread Peter Irbizon
Hello, thanks, Unfortunatelly I don't understand how xml should resolve my issue. My problem is: I am trying to use aes256 cbc on python and php to decrypt "textstring". But results are not the same in php and python. Any idea why? password and iv is the same so I don't know where is the problem. I

Re: Generator Frustration

2011-06-05 Thread Jan Decaluwe
On 06/04/2011 08:27 PM, TommyVee wrote: I'm using the SimPy package to run simulations. Anyone who's used this package knows that the way it simulates process concurrency is through the clever use of yield statements. Some of the code in my programs is very complex and contains several repeating

Re: Lambda question

2011-06-05 Thread Alain Ketterlin
writes: f = lambda x, n, acc=[]: f(x[n:], n, acc+[(x[:n])]) if x else acc f("Hallo Welt", 3) > ['Hal', 'lo ', 'Wel', 't'] > > http://stackoverflow.com/questions/312443/how-do-you-split-a-list-into-evenly-s > ized-chunks-in-python/312644 > > It doesn't work with a huge list, but l

Re: float("nan") in set or as key

2011-06-05 Thread Erik Max Francis
Gregory Ewing wrote: Steven D'Aprano wrote: Fair point. Call it an extension of the Kronecker Delta to the reals then. That's called the Dirac delta function, and it's a bit different -- instead of a value of 1, it has an infinitely high spike of zero width at the origin, whose integral is 1.

Re: float("nan") in set or as key

2011-06-05 Thread Steven D'Aprano
On Sat, 04 Jun 2011 00:29:10 +0100, Nobody wrote: > If you're "fluent" in IEEE-754, then you won't find its behaviour > unexpected. OTOH, if you are approach the issue without preconceptions, > you're likely to notice that you effectively have one exception > mechanism for floating-point and anoth