Re: Suggested feature: slice syntax within tuples (or even more generally)?

2013-02-13 Thread Steven D'Aprano
On Wed, 13 Feb 2013 21:54:43 -0800, stephenwlin wrote: >> I believe the idea of slice literals has been rejected. >> >> > That's too bad...do you have a link to prior discussion on this and what > the reasoning was for rejection? There doesn't seem to be any particular > downside and things wou

"Exception ... in ignored" Messages

2013-02-13 Thread Ami Tavory
Hi, Running the unit tests for some generator code, prints, as a side effect, numerous messages of the form: ... Exception NameError: "global name 'l' is not defined" in ignored Exception AttributeError: "'NoneType' object has no attribute 'close'" in ignored Exception AttributeError: "'Non

Re: Awsome Python - chained exceptions

2013-02-13 Thread Ian Kelly
On Tue, Feb 12, 2013 at 8:01 PM, Rick Johnson wrote: > On Tuesday, February 12, 2013 12:01:45 PM UTC-6, Zero Piraeus wrote: > >> You could call them PyW00ts. > > +1 on the name > -INFINITY on the execution > > Actually i am happy that DeAprano used the unintuitive tag now. Bad enough to > use an

Re: Python Makefiles... are they possible?

2013-02-13 Thread Chris Angelico
On Thu, Feb 14, 2013 at 1:46 PM, Steven D'Aprano wrote: > I prefer to keep the .pyc files, and only remove them when necessary, rather > than to remove them whether it's necessary or not. Solution to that could be just to have your makefile wipe out orphanned pyc files, rather than all of them. S

Re: Awsome Python - chained exceptions

2013-02-13 Thread Steven D'Aprano
On Thu, 14 Feb 2013 09:10:42 +1100, Chris Angelico wrote: Quoting Rick Johnson: >> Q2: Why would the line in the try block be shown as a "feature" of >> the traceback when the whole intent of exception handling is to hide >> the error in the try block! If you want to raise the exception in t

Re: Suggested feature: slice syntax within tuples (or even more generally)?

2013-02-13 Thread stephenwlin
Apparently Travis Oliphant of numpy would like this as well... http://technicaldiscovery.blogspot.com/2011/06/python-proposal-enhancements-i-wish-i.html On Wednesday, February 13, 2013 2:00:15 PM UTC-5, steph...@gmail.com wrote: > Hello, > > > > Would it be feasible to modify the Python gramma

Re: First attempt at a Python prog (Chess)

2013-02-13 Thread Tim Roberts
Chris Hinsley wrote: >New to Python, which I really like BTW. > >First serious prog. Hope you like it. I know it needs a 'can't move if >your King would be put into check' test. But the weighted value of the >King piece does a surprising emergent job. It looks a little like a C program ported

Re: Suggested feature: slice syntax within tuples (or even more generally)?

2013-02-13 Thread stephenwlin
> > I believe the idea of slice literals has been rejected. > That's too bad...do you have a link to prior discussion on this and what the reasoning was for rejection? There doesn't seem to be any particular downside and things would be more consistent with slice syntax allowed anywhere. It w

Re: Statistics...help with numpy/scipy install

2013-02-13 Thread Terry Reedy
On 2/13/2013 9:38 PM, Rex Macey wrote: I am sure I have python installed. I have been running it. in command line the window title is c:\python33\python.exe. The first line begins Python 3.3.0. Later in the line is the string "64 bit ] on Win32". Thus it appears I am trying to run a 32bit numpy

Re: Suggested feature: slice syntax within tuples (or even more generally)?

2013-02-13 Thread Terry Reedy
On 2/13/2013 2:00 PM, stephenw...@gmail.com wrote: Hello, Would it be feasible to modify the Python grammar to allow ':' to generate slice objects everywhere rather than just indexers and top-level tuples of indexers? Right now in Py2.7, Py3.3: "obj[:,2]" yields "obj[slice(None),2]" but

Re: Python Makefiles... are they possible?

2013-02-13 Thread Roy Smith
In article <511c501d$0$6512$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > I prefer to keep the .pyc files, and only remove them when necessary, rather > than to remove them whether it's necessary or not. It's not just because > I'm an arrogant SOB who expects my team of developer

Re: Python Makefiles... are they possible?

2013-02-13 Thread Steven D'Aprano
Roy Smith wrote: > In article <511b2a7c$0$11096$c3e8...@news.astraweb.com>, > Steven D'Aprano wrote: > >> On Tue, 12 Feb 2013 20:06:35 -0500, Roy Smith wrote: >> >> > One thing we do in our Makefiles is "find . -name '*.pyc' | xargs rm". >> > It avoids all sorts of nasty and hard to track down

Re: Statistics...help with numpy/scipy install

2013-02-13 Thread Rex Macey
I am sure I have python installed. I have been running it. in command line the window title is c:\python33\python.exe. The first line begins Python 3.3.0. Later in the line is the string "64 bit ] on Win32". Thus it appears I am trying to run a 32bit numpy with a 64bit python. (Seems like a

Re: First attempt at a Python prog (Chess)

2013-02-13 Thread Chris Hinsley
On 2013-02-13 23:55:20 +, Oscar Benjamin said: On 13 February 2013 23:25, Chris Hinsley wrote: New to Python, which I really like BTW. Glad to hear it. First serious prog. Hope you like it. I know it needs a 'can't move if your King would be put into check' test. But the weighted value

Re: Simulate Keyboard keypress Delay

2013-02-13 Thread 88888 Dihedral
DaGeek247於 2013年2月14日星期四UTC+8上午3時47分36秒寫道: > I am using the windows api feature getasynckeystate() to check the status of > every key pressed; like this; > > > > #always checking > > while(True): > > #iterate through list of ascii codes > > for num in range(0,127): > > #if a

Re: I made a small reddit console feed with python last night

2013-02-13 Thread Verde Denim
On 02/13/2013 04:40 PM, Jared Wright wrote: > If you would like to get a copy of it, instructions are here on Github > > https://github.com/jawerty/AlienFeed > What's a "reddit" console feed? -- http://mail.python.org/mailman/listinfo/python-list

Re: First attempt at a Python prog (Chess)

2013-02-13 Thread Oscar Benjamin
On 13 February 2013 23:25, Chris Hinsley wrote: > New to Python, which I really like BTW. Glad to hear it. > First serious prog. Hope you like it. I know it needs a 'can't move if your > King would be put into check' test. But the weighted value of the King piece > does a surprising emergent job

First attempt at a Python prog (Chess)

2013-02-13 Thread Chris Hinsley
New to Python, which I really like BTW. First serious prog. Hope you like it. I know it needs a 'can't move if your King would be put into check' test. But the weighted value of the King piece does a surprising emergent job. #!/usr/bin/python -tt # -*- coding: utf-8 -*- # Copyright (C) 2013 C

Re: Awsome Python - chained exceptions

2013-02-13 Thread Chris Angelico
On Thu, Feb 14, 2013 at 3:14 AM, Rick Johnson wrote: > On Wednesday, February 13, 2013 12:58:46 AM UTC-6, Chris Angelico wrote: >> No, the offending (not offensive) line is "return items[index-1]", >> which doesn't feature in your traceback at all. > > Do you realize that you are quoting DeAprano

I made a small reddit console feed with python last night

2013-02-13 Thread Jared Wright
If you would like to get a copy of it, instructions are here on Github https://github.com/jawerty/AlienFeed -- http://mail.python.org/mailman/listinfo/python-list

Re: string.replace doesn't removes ":"

2013-02-13 Thread 88888 Dihedral
Rick Johnson於 2013年2月14日星期四UTC+8上午12時34分11秒寫道: > On Wednesday, February 13, 2013 1:10:14 AM UTC-6, jmfauth wrote: > > > > > > >>> d = {ord('a'): 'A', ord('b'): '2', ord('c'): 'C'} > > > >>> 'abcdefgabc'.translate(d) > > > 'A2CdefgA2C' > > > >>> > > > >>> > > > >>> def jmTranslate(s, table):

Help understanding import error

2013-02-13 Thread ctoomey
I'm using TortoiseHg on Windows, which is implemented in python and includes python (2.7.3) as dlls and a bunch of python modules bunded into a library.zip file. I'm trying to use an extension whose __init__.py does the following import: from distutils.version import LooseVersion and am g

Simulate Keyboard keypress Delay

2013-02-13 Thread DaGeek247
I am using the windows api feature getasynckeystate() to check the status of every key pressed; like this; #always checking while(True): #iterate through list of ascii codes for num in range(0,127): #if ascii code key is being pressed if win32api.GetAsyncKeyState(num):

Suggested feature: slice syntax within tuples (or even more generally)?

2013-02-13 Thread stephenwlin
Hello, Would it be feasible to modify the Python grammar to allow ':' to generate slice objects everywhere rather than just indexers and top-level tuples of indexers? Right now in Py2.7, Py3.3: "obj[:,2]" yields "obj[slice(None),2]" but "obj[(:,1),2]" is an error, instead of "obj[(slice

Re: string.replace doesn't removes ":"

2013-02-13 Thread Walter Hurry
On Wed, 13 Feb 2013 16:55:36 +, Mark Lawrence wrote: > On 13/02/2013 16:34, Rick Johnson wrote: >> On Wednesday, February 13, 2013 1:10:14 AM UTC-6, jmfauth wrote: >>> >> d = {ord('a'): 'A', ord('b'): '2', ord('c'): 'C'} >> 'abcdefgabc'.translate(d) >>> 'A2CdefgA2C' >> >> >

Re: string.replace doesn't removes ":"

2013-02-13 Thread Mark Lawrence
On 13/02/2013 16:34, Rick Johnson wrote: On Wednesday, February 13, 2013 1:10:14 AM UTC-6, jmfauth wrote: d = {ord('a'): 'A', ord('b'): '2', ord('c'): 'C'} 'abcdefgabc'.translate(d) 'A2CdefgA2C' def jmTranslate(s, table): ... table = {ord(k):table[k] for k in table} ... return s.t

Re: string.replace doesn't removes ":"

2013-02-13 Thread Rick Johnson
On Wednesday, February 13, 2013 1:10:14 AM UTC-6, jmfauth wrote: > > >>> d = {ord('a'): 'A', ord('b'): '2', ord('c'): 'C'} > >>> 'abcdefgabc'.translate(d) > 'A2CdefgA2C' > >>> > >>> > >>> def jmTranslate(s, table): > ... table = {ord(k):table[k] for k in table} > ... return s.translate(tabl

Re: Awsome Python - chained exceptions

2013-02-13 Thread Rick Johnson
On Wednesday, February 13, 2013 10:14:34 AM UTC-6, Rick Johnson wrote: > The proper method of using a forward compatible print > function is by /importing/ the feature. > >from future import print_function Urm... of course the proper /PROPER/ way would be to NOT throw an import error! f

Re: Awsome Python - chained exceptions

2013-02-13 Thread Rick Johnson
On Wednesday, February 13, 2013 12:58:46 AM UTC-6, Chris Angelico wrote: > On Wed, Feb 13, 2013 at 1:47 PM, Rick Johnson wrote: > >On Tuesday, February 12, 2013 12:15:29 AM UTC-6, Steven D'Aprano wrote: > >> If you've ever written an exception handler, you've probably written a > >> *buggy* excepti

Re: Monitoring updating directory for image for GUI

2013-02-13 Thread Piet van Oostrum
ciscorucin...@gmail.com writes: > WOW...I am thinking that all of this was actually unnecessary, I don't think > I need a Queue, or List / Stack, or any traversal of the file system to > accomplish this!! > > I only need one image displayed at a time and don't care about them > after a newer ima

Re: Python Makefiles... are they possible?

2013-02-13 Thread Roy Smith
In article <511b2a7c$0$11096$c3e8...@news.astraweb.com>, Steven D'Aprano wrote: > On Tue, 12 Feb 2013 20:06:35 -0500, Roy Smith wrote: > > > One thing we do in our Makefiles is "find . -name '*.pyc' | xargs rm". > > It avoids all sorts of nasty and hard to track down bugs (consider what > > hap

Re: Python Makefiles... are they possible?

2013-02-13 Thread Dave Angel
On 02/13/2013 12:54 AM, Steven D'Aprano wrote: On Tue, 12 Feb 2013 20:06:35 -0500, Roy Smith wrote: One thing we do in our Makefiles is "find . -name '*.pyc' | xargs rm". It avoids all sorts of nasty and hard to track down bugs (consider what happens if you move a .py file from one place in you

Re: Python Makefiles... are they possible?

2013-02-13 Thread Benjamin Schollnick
>> One thing we do in our Makefiles is "find . -name '*.pyc' | xargs rm". >> It avoids all sorts of nasty and hard to track down bugs (consider what >> happens if you move a .py file from one place in your source tree to >> another and leave the old .pyc behind). > > How often do you move files ar