Re: python bijection

2009-12-04 Thread geremy condra
On Fri, Dec 4, 2009 at 7:42 PM, Lie Ryan wrote: > On 12/5/2009 9:41 AM, Carl Banks wrote: >> >> On Dec 4, 12:46 pm, geremy condra  wrote: >> more common than full-blown graph package). >>> >>> Sure, its a tree, which is also a graph. In this case it looks to >>> me more like a directed acyclic gra

Re: python bijection

2009-12-04 Thread Carl Banks
On Dec 4, 4:42 pm, Lie Ryan wrote: > On 12/5/2009 9:41 AM, Carl Banks wrote: > > > > > > > On Dec 4, 12:46 pm, geremy condra  wrote: > > more common than full-blown graph package). > >> Sure, its a tree, which is also a graph. In this case it looks to > >> me more like a directed acyclic graph tha

Re: How to timeout when waiting for raw_input from user ?

2009-12-04 Thread Maxim Khitrov
On Fri, Dec 4, 2009 at 6:55 PM, northof40 wrote: > On Dec 5, 12:52 pm, northof40 wrote: >> Hi - I'm writing a *very* simple program for my kids. It asks the user >> to give it the answer to a maths question and says "right" or "wrong" >> >> They now want a timed version where they would only get

Re: python bijection

2009-12-04 Thread Lie Ryan
On 12/5/2009 12:38 PM, geremy condra wrote: Where a list will do, use a list- duh. But when you need a graph, you shouldn't have to homebrew an implementation any more than you should have to homebrew an odict or named tuple, both of which are substantially easier to get right than a graph is.

Re: [distutils] Install script under a different name

2009-12-04 Thread Lie Ryan
On 12/5/2009 11:34 AM, Nikolaus Rath wrote: Hello, All my Python files have extension .py. However, I would like to install scripts that are meant to be called by the user without the suffix, i.e. the file scripts/doit.py should end up as /usr/bin/doit. Apparently the scripts= option of the set

Re: subprocess kill

2009-12-04 Thread Carl Banks
On Dec 4, 3:44 pm, luca72 wrote: > On 5 Dic, 00:14, luca72 wrote: > > > > > > > On 5 Dic, 00:03, luca72 wrote: > > > > On 4 Dic, 23:23, Mike Driscoll wrote: > > > > > On Dec 4, 3:50 pm, luca72 wrote: > > > > > > Hello i'm using subprocess in this way: > > > > > self.luca = subprocess.Popen(['/

Got a single octet from socket, what to do ?

2009-12-04 Thread mudit tuli
I am very new to Python and started getting to know socket programming recently. Made a socket server, which receives a "Single Octet"(treated as a single 8-bit integer field) from a client. But I am not sure what to do with this "Single Octet" and how to decode it into a long integer, so that I ca

Re: Got a single octet from socket, what to do ?

2009-12-04 Thread Stephen Hansen
On Fri, Dec 4, 2009 at 6:39 PM, mudit tuli wrote: > I am very new to Python and started getting to know socket programming > recently. > Made a socket server, which receives a "Single Octet"(treated as a single > 8-bit integer field) from a client. > But I am not sure what to do with this "Single

good code to study

2009-12-04 Thread Michael
I want to improve my knowledge of Python (note: I'm still on 2.5 or 2.6) by studying good existing code, especially GUI programs. Any suggestions? I'm looking at the eric source code now, for starters. Thanks, Mike -- http://mail.python.org/mailman/listinfo/python-list

Re: Can't print Chinese to HTTP

2009-12-04 Thread Gnarlodious
On Dec 2, 11:58 pm, Dennis Lee Bieber wrote: >         Have you tried > >         sys.stdout.write("Content-type:text/plain;charset=utf-8\r\n\r\n") Yes I tried that when it was suggested, to no avail. All I get is "Internal server error". All I can imagine is that there is no "sys.stdout.write" i

Re: python bijection

2009-12-04 Thread geremy condra
On Fri, Dec 4, 2009 at 8:38 PM, Carl Banks wrote: > On Dec 4, 4:42 pm, Lie Ryan wrote: >> On 12/5/2009 9:41 AM, Carl Banks wrote: >> >> >> >> >> >> > On Dec 4, 12:46 pm, geremy condra  wrote: >> > more common than full-blown graph package). >> >> Sure, its a tree, which is also a graph. In this c

Re: Got a single octet from socket, what to do ?

2009-12-04 Thread mudit tuli
Stephen, thanks a lot for the reply. This worked for me. I had a look at the struct module earlier but ignored it due to lack of examples, I'll look more into it. Mudit On Sat, Dec 5, 2009 at 8:17 AM, Stephen Hansen wrote: > On Fri, Dec 4, 2009 at 6:39 PM, mudit tuli wrote: > >> I am very new t

Re: Can't print Chinese to HTTP

2009-12-04 Thread Gnarlodious
On Dec 1, 3:06 pm, Terry Reedy wrote: > def print(s): return sys.stdout.buffer.write(s.encode('utf-8')) Here is a better solution that lets me send any string to the function: def print(html): return sys.stdout.buffer.write(("Content-type:text/ plain;charset=utf-8\n\n"+html).encode('utf-8')) Why

good code to study

2009-12-04 Thread Michael
I want to improve my knowledge of Python (note: I'm still on 2.5 or 2.6) by studying good existing code, especially GUI programs. Any suggestions? I'm looking at the eric source code now, for starters. Thanks, Mike -- http://mail.python.org/mailman/listinfo/python-list

Re: python bijection

2009-12-04 Thread Steven D'Aprano
On Sat, 05 Dec 2009 11:42:15 +1100, Lie Ryan wrote: > I think this could be an interpretation of the Zen: > > Simple is better than complex. > Complex is better than complicated. > > can be read as: > List is better than Tree Because O(N) searches are better than O(log N) searches. Not. How ab

Re: How to timeout when waiting for raw_input from user ?

2009-12-04 Thread Paul Rubin
northof40 writes: > I'm thinking of some logic where a raw_input call is executed and then > if more than X seconds elapses before the prompt is replied to the > process writes a message "Sorry too slow" (or similar). The simplest way to do this is with the alarm function and a signal handler. S

read from standard input

2009-12-04 Thread Siva B
Hi all, I wrote a program to read some data through standard input and write in a file. the following code works fine in linux. but its giving ArgumentError in windows. Code: import sys orig_source = sys.stdin.read() file=open('data.txt','w') file.write(orig_source) file.close() please post s

Re: read from standard input

2009-12-04 Thread Chris Rebert
On Fri, Dec 4, 2009 at 9:37 PM, Siva B wrote: > Hi all, > > I wrote a program to read some data through standard input and write in a > file. > the following code works fine in linux. > but its giving ArgumentError in windows. There's no such error in Python; you're thinking of Ruby. Unless you g

Re: read from standard input

2009-12-04 Thread Siva B
Hi Chris, Thanks for you reply. The error log is here for my above program in windows: Traceback (most recent call last): File "C:\Documents and Settings\user\Desktop\t1.py", line 3, in orig_source = sys.stdin.read() AttributeError: read Regards, Siva On Sat, Dec 5, 2009 at 11:54 AM, Chr

Re: editor with autocompletion

2009-12-04 Thread Siva B
Hi All, Thanks for your reply. What I want is An Editor which can support Dynamic Languages with Autocomplete. I have my own language with some file extension (for ex: *.fs ) I can add few keywords to editor, it should support autocomplte. thats what my idea. plz send me pointers (good if it is

Re: read from standard input

2009-12-04 Thread Chris Rebert
> On Sat, Dec 5, 2009 at 11:54 AM, Chris Rebert wrote: >> >> On Fri, Dec 4, 2009 at 9:37 PM, Siva B wrote: >> > Hi all, >> > >> > I wrote a program to read some data through standard input and write in >> > a >> > file. >> > the following code works fine in linux. >> > but its giving ArgumentErro

<    1   2