Re: Awsome Python - chained exceptions

2013-02-14 Thread Rick Johnson
On Friday, February 15, 2013 12:18:17 AM UTC-6, Chris Angelico wrote: > And yet it is still a perfect example of how a line of > code inside a 'try' block can indeed be offensive. Oh nice try, but we are not fooled by your straw-man. My exact statement that provoked this whole thing was: """ Q1:

Re: Lib to generate XML/JSON[P] output from a DTD/XSD/JSON Schema/etc

2013-02-14 Thread dieter
Acácio Centeno writes: > Hi, I've searched both this group and the web but was unable to find an > answer, sorry if it has already been answered, it seems such a common problem > that I am sure someone has asked before. > > We have a WebServices platform that must reply in XML, JSON, or JSONP.

Re: Awsome Python - chained exceptions

2013-02-14 Thread Chris Angelico
On Fri, Feb 15, 2013 at 1:56 PM, Rick Johnson wrote: > On Thursday, February 14, 2013 6:01:51 AM UTC-6, Ulrich Eckhardt wrote: >> [...] >> >> try: >> rrick.go_and_[edit]_yourself() >> finally: >> rrick.get_lost() > > Oops, you forgot to catch "FloatingPointError" and so your code choked

Re: First attempt at a Python prog (Chess)

2013-02-14 Thread Rick Johnson
On Thursday, February 14, 2013 11:48:10 AM UTC-6, Chris Hinsley wrote: > Is a Python list as fast as a bytearray? Why would you care about that now? Are you running this code on the Xerox Alto? Excuse me for the sarcasm but your post title has perplexed me: "First attempt at a Python prog (Che

Re: Awsome Python - chained exceptions

2013-02-14 Thread Rick Johnson
On Thursday, February 14, 2013 6:01:51 AM UTC-6, Ulrich Eckhardt wrote: > [...] > > try: > rrick.go_and_[edit]_yourself() > finally: > rrick.get_lost() Oops, you forgot to catch "FloatingPointError" and so your code choked in the try block -- typical newbie mistake. -- http://mail.pyt

Re: any chance for contracts and invariants in Python?

2013-02-14 Thread Mark Janssen
See the python extension called "Vigil": https://github.com/munificent/vigil . mark -- http://mail.python.org/mailman/listinfo/python-list

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

2013-02-14 Thread Rick Johnson
On Thursday, February 14, 2013 4:01:39 PM UTC-6, steph...@gmail.com wrote: > On Thursday, February 14, 2013 1:58:06 PM UTC-5, Ian wrote: > > [snip: quote noise!] > Dude! Please trim this quote noise from your posts. I know Google's quoting mechanism is buggy, but dammit man YOU'RE A PROGRAMER!

Re: how to right the regular expression ?

2013-02-14 Thread MRAB
On 2013-02-15 00:32, python wrote: the regex--- pat = r'([a-z].+?\s)(.+?)((\(.+\)))?$' ,do not work at all. [snip] Sorry, that should be: pat1 = r'([a-z].+?\s)(.+?)((\(.+\)))?$' Group 2 should've been lazy "(.+?)", and because of that it should've forced matching the end of the line with "$".

Re:Re: how to right the regular expression ?

2013-02-14 Thread python
the regex--- pat = r'([a-z].+?\s)(.+)(?:(\(.+\)))?' ,do not work at all. >>> rfile.close() >>> import re >>> rfile=open("tv.txt","r") >>> pat1 = r'([a-z].+?\s)(.+)((\(.+\)))?' >>> for line in rfile.readlines(): ... Match=re.match(pat1,line) ... print "1group is ",Match.group(1),"2group

Re: How would you do this?

2013-02-14 Thread eli m
On Thursday, February 14, 2013 4:09:37 PM UTC-8, Oscar Benjamin wrote: > On 14 February 2013 23:34, eli m wrote: > > > I want to make a guess the number game (Which i have), but i want to make > > the computer play the game against itself. How would i do this? > > > > Your question would make

Re: Awsome Python - chained exceptions

2013-02-14 Thread alex23
On Feb 14, 5:00 pm, Ian Kelly wrote: > 2. If you're going to criticize someone for their spelling, at least > be sure to spell correctly the name of the person you are addressing. > You've consistently misspelled Steven's surname in several posts that > I've noticed. The correct spelling conflict

Re: How would you do this?

2013-02-14 Thread Oscar Benjamin
On 14 February 2013 23:34, eli m wrote: > I want to make a guess the number game (Which i have), but i want to make the > computer play the game against itself. How would i do this? Your question would make more sense if you would show your program and also explain how you would like the output

How would you do this?

2013-02-14 Thread eli m
I want to make a guess the number game (Which i have), but i want to make the computer play the game against itself. How would i do this? -- http://mail.python.org/mailman/listinfo/python-list

Re: AttributeError: 'gr_hier_block2_sptr' object has no attribute 'set_callback'

2013-02-14 Thread Albert Hopkins
On Thu, Feb 14, 2013, at 04:39 PM, Dave Angel wrote: [... snip] > For those of us using text-based email, the program in this message is > totally unreadable. This is a text mailing-list, so please put your > email program in text mode, or you'll lose much of your audience. For those of us n

[ANN] pypiserver 1.1.0 - minimal private pypi server

2013-02-14 Thread Ralf Schmitt
Hi, I've just uploaded pypiserver 1.1.0 to the python package index. pypiserver is a minimal PyPI compatible server. It can be used to serve a set of packages and eggs to easy_install or pip. pypiserver is easy to install (i.e. just 'pip install pypiserver'). It doesn't have any external depende

Re: First attempt at a Python prog (Chess)

2013-02-14 Thread Chris Hinsley
On 2013-02-14 21:14:03 +, jkn said: Hi Chris On Wednesday, 13 February 2013 23:25:09 UTC, Chris Hinsley wrote: New to Python, which I really like BTW. Welcome aboard! But aren't you supposed to be writing Forth? ;-) Cheers Jon N Well, I'm experimenting with other things too

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

2013-02-14 Thread stephenwlin
On Thursday, February 14, 2013 1:58:06 PM UTC-5, Ian wrote: > > That's not ambiguous, because the former is simply invalid syntax. > > However, consider the following. > > > > if 1: 2: > > > > That could be either a one-line if statement where the condition is 1 > > and the body is slice(2

Python trademark under attack -- the PSF needs your help

2013-02-14 Thread Steven D'Aprano
Hello all, The Python Software Foundation is the organisation which protects and manages the "boring" bits of keeping a big open source project alive: the legal and contractual parts, funding for projects, trademarks and copyrights. If you are based in Europe, or know somebody who uses Python in

Re: AttributeError: 'gr_hier_block2_sptr' object has no attribute 'set_callback'

2013-02-14 Thread Dave Angel
On 02/14/2013 04:16 PM, md...@nycap.rr.com wrote: I am using ubuntu 12.10 and python version 2.7.3. i run the following command in terminal: def connect(self, *points): """ Connect two or more block endpoints. An endpoint is either a (block, port) tuple or a block instance. In the latter

AttributeError: 'gr_hier_block2_sptr' object has no attribute 'set_callback'

2013-02-14 Thread md123
I am using ubuntu 12.10 and python version 2.7.3. i run the following command in terminal: matt@matt-Inspiron-1525:~$ python -m trace --count -C . op25_grc.py Here is the output with an error: Imported legacy fsk4 Using Volk machine: ssse3_32 Traceback (most recent call last): File "/usr/lib/p

Re: First attempt at a Python prog (Chess)

2013-02-14 Thread jkn
Hi Chris On Wednesday, 13 February 2013 23:25:09 UTC, Chris Hinsley wrote: > New to Python, which I really like BTW. Welcome aboard! But aren't you supposed to be writing Forth? ;-) Cheers Jon N -- http://mail.python.org/mailman/listinfo/python-list

Lib to generate XML/JSON[P] output from a DTD/XSD/JSON Schema/etc

2013-02-14 Thread Acácio Centeno
Hi, I've searched both this group and the web but was unable to find an answer, sorry if it has already been answered, it seems such a common problem that I’m sure someone has asked before. We have a WebServices platform that must reply in XML, JSON, or JSONP. Having to convert between these fo

Fwd: Re:

2013-02-14 Thread Matt Jones
Sending back to the maillist *Matt Jones* -- Forwarded message -- From: Date: Thu, Feb 14, 2013 at 1:42 PM Subject: Re: Re: To: Matt Jones thanks for replying Matt. I am using version 2.7.3. im not sure if this is right but here is the code from "/usr/local/lib/python2.7/d

Peter Otten

2013-02-14 Thread Ami Tavory
From: Peter Otten <__pete...@web.de> To: python-list@python.org Cc: Date: Thu, 14 Feb 2013 09:00:58 +0100 Subject: Re: "Exception ... in ignored" Messages Ami Tavory wrote: > Hi, > > Running the unit tests for some generator code, prints, as a side > effect, > numerous messages of the form:

Re: Binary tree implementation

2013-02-14 Thread Gary Herron
On 02/14/2013 11:18 AM, Megha Agrawal wrote: Hello All, I am a newbie to python language. I need your help in implementation of Binary tree in python. I have a count of nodes and I need to draw a binary tree. Suppose if count is 5 then tree will look like 1

Binary tree implementation

2013-02-14 Thread Megha Agrawal
Hello All, I am a newbie to python language. I need your help in implementation of Binary tree in python. I have a count of nodes and I need to draw a binary tree. Suppose if count is 5 then tree will look like 1

[no subject]

2013-02-14 Thread Megha Agrawal
Hello All, I am a newbie to python language. I need your help in implementation of Binary tree in python. I have a count of nodes and I need to draw a binary tree. Suppose if count is 5 then tree will look like 1

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

2013-02-14 Thread Ian Kelly
On Thu, Feb 14, 2013 at 1:03 AM, Steven D'Aprano wrote: > E.g.: > > if x: > pass > > > Is that intended as "if slice(x, None, None)" with a missing colon, or > "if x" with colon supplied? That's not ambiguous, because the former is simply invalid syntax. However, consider the following. if 1

Re:

2013-02-14 Thread Matt Jones
Please post the code, or a link to the code... Also, what version of python are you running this code over? *Matt Jones* On Thu, Feb 14, 2013 at 12:26 PM, wrote: > using ubuntu 12.10 i am trying to run a python block, namely OP25, in > GNU Radio Companion v3.6.3-35-g4435082f. i get the foll

Re: any chance for contracts and invariants in Python?

2013-02-14 Thread Ethan Furman
On 02/14/2013 10:05 AM, Ian Kelly wrote: On Thu, Feb 14, 2013 at 10:03 AM, Philipp Hagemeister wrote: So any implementation has to choose one of the following: 1. Ignore invariants and postconditions of inherited classes - defeats the purpose. 2. Only respect definitions in classes and methods

Re: First attempt at a Python prog (Chess)

2013-02-14 Thread Ian Kelly
On Thu, Feb 14, 2013 at 10:48 AM, Chris Hinsley wrote: > Is a Python list as fast as a bytearray ? I didn't copy a C prog BTW ! >>> from timeit import Timer >>> t1 = Timer("board[36] = board[20]; board[20] = ' '", "board = >>> bytearray('RNBQKBNR >>> p

[no subject]

2013-02-14 Thread md123
using ubuntu 12.10 i am trying to run a python block, namely OP25, in GNU Radio Companion v3.6.3-35-g4435082f. i get the following error: Executing: "/home/matt/op25_grc.py" Imported legacy fsk4 Using Volk machine: ssse3_32 Traceback (most recent call last): File "/home/matt/op25_grc.py", line

Re: any chance for contracts and invariants in Python?

2013-02-14 Thread MRAB
On 2013-02-14 18:05, Ian Kelly wrote: On Thu, Feb 14, 2013 at 10:03 AM, Philipp Hagemeister wrote: So any implementation has to choose one of the following: 1. Ignore invariants and postconditions of inherited classes - defeats the purpose. 2. Only respect definitions in classes and methods in

Re: OpenCV and WIFI IP Camera Issue

2013-02-14 Thread MRAB
On 2013-02-14 17:25, Sam Berry wrote: Hey, Iv installed OpenCV on my windows machine. I can successfully view the > camera stream from my laptop so the installation was successful. > However when i edited the code adding in the address of my IP camera > like so import cv2 cv2.namedWindow

Re: any chance for contracts and invariants in Python?

2013-02-14 Thread Ian Kelly
On Thu, Feb 14, 2013 at 10:03 AM, Philipp Hagemeister wrote: > So any implementation has to choose one of the following: > > 1. Ignore invariants and postconditions of inherited classes - defeats > the purpose. > 2. Only respect definitions in classes and methods in the original > definition, whic

Re: First attempt at a Python prog (Chess)

2013-02-14 Thread Chris Hinsley
On 2013-02-14 06:05:13 +, Tim Roberts said: 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

Re: any chance for contracts and invariants in Python?

2013-02-14 Thread Philipp Hagemeister
I don't know anything about the status of this PEP or why it hasn't been implemented, but here's what strikes me as obviously complex: Doesn't one need to traverse the entire class hierarchy on every function call? So if I have class A: def foo(self): return 1 class B(A): "inv: True" d

OpenCV and WIFI IP Camera Issue

2013-02-14 Thread Sam Berry
Hey, Iv installed OpenCV on my windows machine. I can successfully view the camera stream from my laptop so the installation was successful. However when i edited the code adding in the address of my IP camera like so import cv2 cv2.namedWindow("preview") vc = cv2.VideoCapture('http://192

Re: Simulate Keyboard keypress Delay

2013-02-14 Thread inq1ltd
On Wednesday, February 13, 2013 11:47:36 AM DaGeek247 wrote: > 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 as

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

2013-02-14 Thread stephenwlin
> > You can't just allow ':' to generate slice objects everwhere without > > introducing ambiguity, so your proposal would have to be to allow slice > > objects in wider but still restricted contexts. Yeah, I mentioned that in a follow-up. I'm pretty sure of just allowing it within [] and ()

Re: how to right the regular expression ?

2013-02-14 Thread MRAB
On 2013-02-14 14:13, python wrote: my tv.txt is : http://202.177.192.119/radio5 香港电台第五台(可于Totem/VLC/MPlayer播放) http://202.177.192.119/radio35 香港电台第五台(DAB版,可于Totem/VLC/MPlayer播放) http://202.177.192.119/radiopth 香港电台普通话台(可于Totem/VLC/MPlayer播放) http://202.177.192.119/radio31 香港电台普通话台(DAB版,可于Totem/VL

ISLAM and the AIM of LIFE

2013-02-14 Thread BV BV
ISLAM and the AIM of LIFE What is your purpose in life? What is the rationale behind our life? Why do we live in this life? These questions frequently intrigue people who try to find accurate answers. People provide different answers to these questions. Some people believe the purpose of life is to

how to right the regular expression ?

2013-02-14 Thread python
my tv.txt is : http://202.177.192.119/radio5 香港电台第五台(可于Totem/VLC/MPlayer播放) http://202.177.192.119/radio35 香港电台第五台(DAB版,可于Totem/VLC/MPlayer播放) http://202.177.192.119/radiopth 香港电台普通话台(可于Totem/VLC/MPlayer播放) http://202.177.192.119/radio31 香港电台普通话台(DAB版,可于Totem/VLC/MPlayer播放) octoshape:rthk

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

2013-02-14 Thread Duncan Booth
stephenw...@gmail.com wrote: > 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? > Would this be a dict with a slice as key or value, or a set with a slice with a step?: {1:2:3

Re: Awsome Python - chained exceptions

2013-02-14 Thread Ulrich Eckhardt
Am 13.02.2013 um 17:14 schrieb Rick Johnson: Q1: How could a line in the "try" block ever be considered offensive? Because it throws an error? try: rrick.go_and_fuck_yourself() finally: rrick.get_lost() See, wasn't that difficult, was it? :D Are you serious? No, I just coul

any chance for contracts and invariants in Python?

2013-02-14 Thread mrkafk
This PEP seems to be gathering dust: http://www.python.org/dev/peps/pep-0316/ I was thinking the other day, would contracts and invariants not be better than unit tests? That is, they could do what unit tests do and more, bc they run at execution time and not just at development time? -- htt

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

2013-02-14 Thread Oscar Benjamin
On 14 February 2013 05:29, Terry Reedy wrote: > 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 ] >

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

2013-02-14 Thread Dave Angel
On 02/13/2013 09: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 n

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

2013-02-14 Thread stephenwlin
> Hah, yes. I basically wrote that exact example in my reply to Steven at the > same time you replied. numpy.s_ is similar (although I think it does some > extra work for odd reasons). Oops, this is silly in retrospect...sorry, wasn't looking at the From: line carefully enough and didn't realiz

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

2013-02-14 Thread stephenwlin
On Thursday, February 14, 2013 3:03:50 AM UTC-5, Steven D'Aprano wrote: > 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 >

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

2013-02-14 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 wi

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

2013-02-14 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? http://osdir.com/ml/python.python-3000.devel/2006-05/msg00686.ht

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

2013-02-14 Thread jmfauth
On 13 fév, 21:24, 8 Dihedral wrote: > 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' > > >

Re: "Exception ... in ignored" Messages

2013-02-14 Thread Peter Otten
Ami Tavory wrote: > 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 _dagpype_internal_fn_act at 0x9d4c500> ignored > Exception AttributeError: "'NoneType