Re: How can I know how much to read from a subprocess

2007-09-18 Thread spam . noam
On Sep 18, 1:48 pm, "A.T.Hofkamp" <[EMAIL PROTECTED]> wrote: > On 2007-09-17, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > It seems that another solution is gobject.io_add_watch, but I don't > > see how it tells me how much I can read from the file - if I don't > > know that, I won't know the

Re: How can I know how much to read from a subprocess

2007-09-17 Thread spam . noam
Ok, I could have researched this before posting, but here's an explanation how to do it with twisted: http://unpythonic.blogspot.com/2007/08/spawning-subprocess-with-pygtk-using.html It seems that another solution is gobject.io_add_watch, but I don't see how it tells me how much I can read from t

How can I know how much to read from a subprocess

2007-09-17 Thread spam . noam
Hello, I want to write a terminal program in pygtk. It will run a subprocess, display everything it writes in its standard output and standard error, and let the user write text into its standard input. The question is, how can I know if the process wrote something to its output, and how much it

ANN: byteplay - a bytecode assembler/disassembler

2006-08-14 Thread spam . noam
Hello, I would like to present a module that I have wrote, called byteplay. It's a Python bytecode assembler/disassembler, which means that you can take Python code object, disassemble them into equivalent objects which are easy to play with, play with them, and then assemble a new, modified, code

Re: Allowing zero-dimensional subscripts

2006-06-10 Thread spam . noam
George Sakkis wrote: > [EMAIL PROTECTED] wrote: > > > However, I'm designing another library for > > managing multi-dimensional arrays of data. Its purpose is similiar to > > that of a spreadsheet - analyze data and preserve the relations between > > a source of a calculation and its destination. >

Re: Allowing zero-dimensional subscripts

2006-06-09 Thread spam . noam
Hello, Following Fredrik's suggestion, I wrote a pre-PEP. It's available on the wiki, at http://wiki.python.org/moin/EmptySubscriptListPEP and I also copied it to this message. Have a good day, Noam PEP: XXX Title: Allow Empty Subscript List Without Parentheses Version: $Revision$ Last-Modified

Re: Allowing zero-dimensional subscripts

2006-06-09 Thread spam . noam
Hello, Fredrik Lundh wrote: > (but should it really result in an empty tuple? wouldn't None be a bit > more Pythonic?) I don't think it would. First of all, x[()] already has the desired meaning in numpy. But I think it's the right thing - if you think of what's inside the brackets as a list of

Re: Allowing zero-dimensional subscripts

2006-06-09 Thread spam . noam
Hello, Sybren Stuvel wrote: > I think it's ugly to begin with. In math, one would write simply 'x' > to denote an unsubscribed (ubsubscripted?) 'x'. And another point, why > would one call __getitem__ without an item to call? I think that in this case, mathematical notation is different from pyth

Re: Allowing zero-dimensional subscripts

2006-06-08 Thread spam . noam
Hello, Terry Reedy wrote: > So I do not see any point or usefulness in saying that a tuple subcript is > not what it is. I know that a tuple is *constructed*. The question is, is this, conceptually, the feature that allows you to ommit the parentheses of a tuple in some cases. If we see this as t

Re: Allowing zero-dimensional subscripts

2006-06-08 Thread spam . noam
Hello, Terry Reedy wrote: > > In a few more words: Currently, an object can be subscripted by a few > > elements, separated by commas. It is evaluated as if the object was > > subscripted by a tuple containing those elements. > > It is not 'as if'. 'a,b' *is* a tuple and the object *is* subcript

Allowing zero-dimensional subscripts

2006-06-08 Thread spam . noam
Hello, I discovered that I needed a small change to the Python grammar. I would like to hear what you think about it. In two lines: Currently, the expression "x[]" is a syntax error. I suggest that it will be evaluated like "x[()]", just as "x[a, b]" is evaluated like "x[(a, b)]" right now. In a

Re: Why keep identity-based equality comparison?

2006-01-10 Thread spam . noam
It seems to me that both Mike's and Fuzzyman's objections were that sometimes you want the current behaviour, of saying that two objects are equal if they are: 1. the same object or 2. have the same value (when it's meaningful). In both cases this can be accomplished pretty easily: You can do it w

Re: Why keep identity-based equality comparison?

2006-01-10 Thread spam . noam
> Can you provide a case where having a test for equality throw an > exception > is actually useful? Yes. It will be useful because: 1. The bug of not > finding a key in a dict because it was implicitly hashed by identity and not > by value, would not have happened. 2. You wouldn't get the wei

Why keep identity-based equality comparison?

2006-01-09 Thread spam . noam
Hello, Guido has decided, in python-dev, that in Py3K the id-based order comparisons will be dropped. This means that, for example, "{} < []" will raise a TypeError instead of the current behaviour, which is returning a value which is, really, id({}) < id([]). He also said that default equality c

Convention for C functions success/failure

2005-12-03 Thread spam . noam
Hello, What is the convention for writing C functions which don't return a value, but can fail? If I understand correctly, 1. PyArg_ParseTuple returns 0 on failure and 1 on success. 2. PySet_Add returns -1 on failure and 0 on success. Am I correct? What should I do with new C functions that I wr