Re: automate minesweeper with python

2010-06-30 Thread Jay
On Jun 30, 6:01 pm, Justin Ezequiel wrote: > On Jul 1, 7:39 am, Jay wrote: > > > I would like to create a python script that plays the Windows game > > minesweeper. > > > The python code logic and running minesweeper are not problems. > > However, "seeing" the 1-8 in the minesweeper map and click

Re: automate minesweeper with python

2010-06-30 Thread MRAB
Jay wrote: On Jun 30, 6:01 pm, Justin Ezequiel wrote: On Jul 1, 7:39 am, Jay wrote: I would like to create a python script that plays the Windows game minesweeper. The python code logic and running minesweeper are not problems. However, "seeing" the 1-8 in the minesweeper map and clicking on

Re: automate minesweeper with python

2010-06-30 Thread Ian Kelly
On Wed, Jun 30, 2010 at 7:15 PM, Jay wrote: > On Jun 30, 6:01 pm, Justin Ezequiel > wrote: >> you may want to have a look at sikulihttp://groups.csail.mit.edu/uid/sikuli/ > > Intresting, but I actually have something already in python I want to > modify. You should be able to use it with Jython.

Re: I strongly dislike Python 3

2010-06-30 Thread John Nagle
On 6/27/2010 1:09 PM, Martin v. Loewis wrote: I agree that there may be not much reason to port custom proprietary apps that are working fine and which would hardly benefit from, let alone need, and new Py3 features. In the long run, there will be a benefit: at some point in the future (surely

Re: automate minesweeper with python

2010-06-30 Thread Paul McGuire
On Jun 30, 6:39 pm, Jay wrote: > I would like to create a python script that plays the Windows game > minesweeper. > > The python code logic and running minesweeper are not problems. > However, "seeing" the 1-8 in the minesweeper map and clicking on > squares is. I have no idea how to proceed. Yo

Re: I strongly dislike Python 3

2010-06-30 Thread Steven D'Aprano
On Wed, 30 Jun 2010 18:57:58 -0400, geremy condra wrote: >>> Actually, I agree with this complaint though- it is much easier to >>> type spaces than parens. >> >> Yes. And typing "p" is easier than typing "print". Perhaps we should >> replace all Python built-ins with one letter names so that we c

Re: I strongly dislike Python 3

2010-06-30 Thread Stephen Hansen
On 6/30/10 6:48 PM, John Nagle wrote: The 10th anniversary of the announcement of PERL 6 is coming up on July 19th, and it still hasn't displaced PERL 5 as the "primary" version. Now, I may be totally off-base, because I do not grok perl and so have never made much of an effort to follow perl-

Re: I strongly dislike Python 3

2010-06-30 Thread MRAB
John Nagle wrote: On 6/27/2010 1:09 PM, Martin v. Loewis wrote: I agree that there may be not much reason to port custom proprietary apps that are working fine and which would hardly benefit from, let alone need, and new Py3 features. In the long run, there will be a benefit: at some point in

Re: I strongly dislike Python 3

2010-06-30 Thread geremy condra
On Wed, Jun 30, 2010 at 10:06 PM, Steven D'Aprano wrote: > On Wed, 30 Jun 2010 18:57:58 -0400, geremy condra wrote: > Actually, I agree with this complaint though- it is much easier to type spaces than parens. >>> >>> Yes. And typing "p" is easier than typing "print". Perhaps we should >

Re: I strongly dislike Python 3

2010-06-30 Thread Ben Finney
Steven D'Aprano writes: > But, honestly, is there anyone here, even the most heavy users of > print, who would seriously expect that adding parentheses to print > calls will do more than add a tiny fraction to the amount of typing > effort already required to use Python? I suppose in principle th

Re: A question about the posibility of raise-yield in Python

2010-06-30 Thread Carl Banks
On Jun 30, 12:13 am, Дамјан Георгиевски wrote: > > I'm writing this as a complete newbie (on the issue), so don't be > > surprised if it's the stupidest idea ever. > > > I was wondering if there was ever a discusision in the python > > community on a 'raise-yield' kind-of combined expression. I'd

Composition of functions

2010-06-30 Thread Mladen Gogala
If I write things with the intermediate variables like below, everything works: >>> x="quick brown fox jumps over a lazy dog" >>> y=list(x) >>> y ['q', 'u', 'i', 'c', 'k', ' ', 'b', 'r', 'o', 'w', 'n', ' ', 'f', 'o', 'x', ' ', 'j', 'u', 'm', 'p', 's', ' ', 'o', 'v', 'e', 'r', ' ', 'a', ' ', 'l'

Re: Composition of functions

2010-06-30 Thread Stephen Hansen
On 6/30/10 8:50 PM, Mladen Gogala wrote: x="quick brown fox jumps over a lazy dog" y=''.join(list(x).reverse()) Traceback (most recent call last): File "", line 1, in TypeError Why is TypeError being thrown? The reason for throwing the type error is the fact that the internal expressio

Re: Composition of functions

2010-06-30 Thread Zubin Mithra
Hello, >>> y=list(x).reverse() > >>> print y > None > >>> L = ["a", "b", "c"] >>> L.reverse() >>> L ["c", "b", "a"] As you can see, L.reverse() performs the operation on itself and returns nothing. Hence, the return type None. Instead of y=''.join(list(x).reverse()) you should probably do, >

Very odd output from subprocess

2010-06-30 Thread m
I have this function: def GetMakeOutput(make, rules, out=None): p = subprocess.Popen('%s %s' % (make,rules), shell=True, bufsize=1024, stderr=subprocess.PIPE, stdout=subprocess.PIPE,

Re: Composition of functions

2010-06-30 Thread Chris Rebert
On Wed, Jun 30, 2010 at 9:09 PM, Zubin Mithra wrote: > Hello, > >> >>> y=list(x).reverse() >> >>> print y >> None > L = ["a", "b", "c"] L.reverse() L > ["c", "b", "a"] > > As you can see, L.reverse() performs the operation on itself and returns > nothing. Hence, the return type None

Re: Composition of functions

2010-06-30 Thread Zubin Mithra
> Er, I don't think you thought that one entirely through (/ tried it out): > > My Apologies. Here is a working one. >>> x="123" >>> t = list(x) >>> t.reverse() >>> print ''.join(t) 321 But of course, the method which was suggested earlier is far more elegant. >>> print ''.join(reversed(list(

Re: Very odd output from subprocess

2010-06-30 Thread Chris Rebert
On Wed, Jun 30, 2010 at 9:12 PM, m wrote: > I have this function: > > > def GetMakeOutput(make, rules, out=None): >    p = subprocess.Popen('%s %s' % (make,rules), >                         shell=True, >                         bufsize=1024, >                         stderr=subprocess.PIPE, >    

Re: Composition of functions

2010-06-30 Thread Mladen Gogala
On Wed, 30 Jun 2010 21:04:28 -0700, Stephen Hansen wrote: > On 6/30/10 8:50 PM, Mladen Gogala wrote: > x="quick brown fox jumps over a lazy dog" > y=''.join(list(x).reverse()) >> Traceback (most recent call last): >>File "", line 1, in >> TypeError > > >> >> Why is TypeError be

Re: I strongly dislike Python 3

2010-06-30 Thread Steven D'Aprano
On Thu, 01 Jul 2010 13:13:53 +1000, Ben Finney wrote: > Steven D'Aprano writes: > >> But, honestly, is there anyone here, even the most heavy users of >> print, who would seriously expect that adding parentheses to print >> calls will do more than add a tiny fraction to the amount of typing >> e

Re: I strongly dislike Python 3

2010-06-30 Thread Ben Finney
Steven D'Aprano writes: > On Thu, 01 Jul 2010 13:13:53 +1000, Ben Finney wrote: > > > Steven D'Aprano writes: > >> I suppose in principle those extra three key presses (shift-9 > >> shift-0 vs space) could be the straw that breaks the camel's back, > >> but I doubt it. > > > > There's also Fitt

Re: I strongly dislike Python 3

2010-06-30 Thread geremy condra
On Thu, Jul 1, 2010 at 1:02 AM, Ben Finney wrote: > Steven D'Aprano writes: > >> On Thu, 01 Jul 2010 13:13:53 +1000, Ben Finney wrote: >> >> > Steven D'Aprano writes: >> >> I suppose in principle those extra three key presses (shift-9 >> >> shift-0 vs space) could be the straw that breaks the ca

Re: Python dynamic attribute creation

2010-06-30 Thread Aahz
In article <4c29ad38$0$26210$426a7...@news.free.fr>, Bruno Desthuilliers wrote: >Aahz a écrit : >> In article <4c285e7c$0$17371$426a7...@news.free.fr>, >> Bruno Desthuilliers wrote: >>> Aahz a écrit : In article <4c2747c1$0$4545$426a7...@news.free.fr>, Bruno Desthuilliers wrote: >>>

Re: [farther OT] Re: Why Is Escaping Data Considered So Magical?

2010-06-30 Thread Michael Torrie
On 06/30/2010 06:36 PM, Lawrence D'Oliveiro wrote: > In message , > Michael Torrie wrote: > >> Okay, I will. Your code passes a char** when a char* is expected. > > No it doesn’t. You're right; it doesn't. Your code passes char (*)[512]. warning: passing argument 1 of ‘snprintf’ from incompati

Re: Need instruction on how to use isinstance

2010-06-30 Thread alex23
Hans Mulder wrote: > There's also: hasattr(, '__call__').  It works in both 2.x and 3.x. Good work, Hans. I do find that to be a more pythonic approach, personally, being more concerned with an object's ability than its abstract type. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python dynamic attribute creation

2010-06-30 Thread Stephen Hansen
On 6/30/10 10:37 PM, Aahz wrote: In article<4c29ad38$0$26210$426a7...@news.free.fr>, Bruno Desthuilliers wrote: Aahz a écrit : In article<4c285e7c$0$17371$426a7...@news.free.fr>, Bruno Desthuilliers wrote: Aahz a écrit : In article<4c2747c1$0$4545$426a7...@news.free.fr>, Bruno Desthuilliers

Reversing backslashed escape sequences

2010-06-30 Thread Steven D'Aprano
I have a byte-string which is an escape sequence, that is, it starts with a backslash, followed by either a single character, a hex or octal escape sequence. E.g. something like one of these in Python 2.5: '\\n' '\\xFF' '\\023' If s is such a string, what is the right way to un-escape them to s

Solutions for hand injury from computer use (was: I strongly dislike Python 3)

2010-06-30 Thread Ben Finney
geremy condra writes: > > Right. I'm much more concerned about the position of my Ctrl key, to > > avoid hand injury from all the key chording done as a programmer. > > Not saying its a cure-all, but I broke my hand pretty badly a few years > ago and had a lot of luck with a homemade foot switch

Re: Reversing backslashed escape sequences

2010-06-30 Thread Chris Rebert
On Wed, Jun 30, 2010 at 10:50 PM, Steven D'Aprano wrote: > I have a byte-string which is an escape sequence, that is, it starts with > a backslash, followed by either a single character, a hex or octal escape > sequence. E.g. something like one of these in Python 2.5: > > '\\n' > '\\xFF' > '\\023'

Re: A question about the posibility of raise-yield in Python

2010-06-30 Thread Ryan Kelly
On Wed, 2010-06-30 at 16:20 -0700, ru...@yahoo.com wrote: > On Jun 30, 10:48 am, John Nagle wrote: > > On 6/30/2010 12:13 AM, Дамјан Георгиевски wrote: > > > > >> A 'raise-yield' expression would break the flow of a program just like > > >> an exception, going up the call stack until it would be h

Re: Reversing backslashed escape sequences

2010-06-30 Thread Mark Tolonen
"Steven D'Aprano" wrote in message news:4c2c2cab$0$14136$c3e8...@news.astraweb.com... I have a byte-string which is an escape sequence, that is, it starts with a backslash, followed by either a single character, a hex or octal escape sequence. E.g. something like one of these in Python 2.5: '

Re: Reversing backslashed escape sequences

2010-06-30 Thread Steven D'Aprano
On Wed, 30 Jun 2010 23:11:59 -0700, Chris Rebert wrote: > Python 2.6.5 (r265:79063, May 25 2010, 18:21:57) '\\xFF'.decode('string_escape') > '\xff' I knew unicode-escape, obviously, and then I tried just 'escape', but never thought of 'string_escape'. Thanks for the quick answer. -- Ste

<    1   2