Re: [Python-3000] map() Returns Iterator

2007-08-04 Thread Jeffrey Yasskin
Is it possible to make the result of map() look like a list if people are paying attention, but use memory like an iterator when they're not? We'd want to distinguish between: x = map(...) and for x in map(...) Actually, to get any use out of it, we'd need to allow the first case, as long as

Re: [Python-3000] More PEP 3101 changes incoming

2007-08-04 Thread Greg Ewing
Talin wrote: > But the formatters for int and float have to happen *after* type > coercion. I don't see why. Couldn't the __format__ method for an int recognise float formats as well and coerce itself as necessary? > (I should also mention that "a:b,c" looks prettier to my eye than > "a,b:c".

Re: [Python-3000] More PEP 3101 changes incoming

2007-08-04 Thread Greg Ewing
Ron Adam wrote: > '{0:10;20,f.2}' > > Works for me. It doesn't work for me, as it breaks up into 0:10; 20,f.2 i.e. semicolons separate more strongly than commas to my eyes. -- Greg ___ Python-3000 mailing list [email protected] http://m

Re: [Python-3000] map() Returns Iterator

2007-08-04 Thread Greg Ewing
Jeffrey Yasskin wrote: > > Is it possible to make the result of map() look like a list if people > are paying attention, but use memory like an iterator when they're > not? I suppose it could lazily materialise a list behind the scenes when needed (i.e. on the first __getitem__ or __len__ call),

Re: [Python-3000] More PEP 3101 changes incoming

2007-08-04 Thread Ron Adam
Greg Ewing wrote: > Ron Adam wrote: > >> '{0:10;20,f.2}' >> >> Works for me. > > It doesn't work for me, as it breaks up into > >0:10; 20,f.2 > > i.e. semicolons separate more strongly than commas > to my eyes. And after my reply I realized this looks a bit odd. {0:;20,f.2} B

Re: [Python-3000] More PEP 3101 changes incoming

2007-08-04 Thread Ron Adam
Ron Adam wrote: > An alternative I thought of this morning is to reuse the alignment symbols > '^', '+', and '-' and require a minimum width if a maximum width is specified. One more (or two) additions to this... In the common cases of generating columnar reports, the min_width and max_width

[Python-3000] py3k conversion docs?

2007-08-04 Thread skip
I'm looking at the recently submitted patch for the csv module and am scratching my head a bit trying to understand the code transformations. I've not looked at any py3k code yet, so this is all new to me. Is there any documentation about the Py3k conversion? I'm particularly interested in the st

[Python-3000] atexit module problems/questions

2007-08-04 Thread skip
During the recast of the atexit module into C it grew _clear and unregister functions. I can understand that a clear function might be handy, but why is it private? Given that sys.exitfunc is gone is there a reason to have _run_exitfuncs? Who's going to call it? Finally, I can see a situation wh

Re: [Python-3000] py3k conversion docs?

2007-08-04 Thread Guido van Rossum
I haven't seen the patch you mention, and unfortunately there aren't docs for the conversion yet. However, one thing to note is that in 2.x, the PyString type ('str') is used for binary data, encoded text data, and decoded text data. In 3.0, binary and encoded text are represented using PyBytes ('

Re: [Python-3000] atexit module problems/questions

2007-08-04 Thread skip
skip> Given that sys.exitfunc is gone is there a reason to have skip> _run_exitfuncs? Who's going to call it? I should have elaborated. Clearly you need some way to call it, but since that is going to be called from C code (isn't it?), why expose it to Python code? Skip ___

Re: [Python-3000] atexit module problems/questions

2007-08-04 Thread Christian Heimes
[EMAIL PROTECTED] wrote: > skip> Given that sys.exitfunc is gone is there a reason to have > skip> _run_exitfuncs? Who's going to call it? > > I should have elaborated. Clearly you need some way to call it, but since > that is going to be called from C code (isn't it?), why expose it to

Re: [Python-3000] More PEP 3101 changes incoming

2007-08-04 Thread Greg Ewing
Ron Adam wrote: > Which would result in a first column that right aligns, a second column > that centers unless the value is longer than 100, in which case it right > align, and cuts the end, and a third column that left aligns, but cuts off > the right if it's over 15. All this talk about cutt

Re: [Python-3000] atexit module problems/questions

2007-08-04 Thread Greg Ewing
[EMAIL PROTECTED] wrote: > I can see a situation where you might register the same function > multiple times with different argument lists, yet unregister takes only the > function as the discriminator. One way to fix this would be to remove the ability to register arguments along with the functio

Re: [Python-3000] test_asyncore fails intermittently on Darwin

2007-08-04 Thread Jeffrey Yasskin
Well, regardless of the brokenness of the patch, I do get two different failures from this test on OSX. The first is caused by trying to socket.bind() a port that's already been bound recently: Exception in thread Thread-2: Traceback (most recent call last): File "/Users/jyasskin/src/python/test

Re: [Python-3000] More PEP 3101 changes incoming

2007-08-04 Thread Guido van Rossum
On 8/4/07, Greg Ewing <[EMAIL PROTECTED]> wrote: > Ron Adam wrote: > > Which would result in a first column that right aligns, a second column > > that centers unless the value is longer than 100, in which case it right > > align, and cuts the end, and a third column that left aligns, but cuts off

Re: [Python-3000] atexit module problems/questions

2007-08-04 Thread skip
skip> Given that sys.exitfunc is gone is there a reason to have skip> _run_exitfuncs? Who's going to call it? Christian> Unit tests? Some developers might want to test their Christian> registered functions. Your tests can just fork another instance of Python which prints: p

Re: [Python-3000] atexit module problems/questions

2007-08-04 Thread skip
>> I can see a situation where you might register the same function >> multiple times with different argument lists, yet unregister takes >> only the function as the discriminator. Greg> One way to fix this would be to remove the ability to register Greg> arguments along with

Re: [Python-3000] More PEP 3101 changes incoming

2007-08-04 Thread Talin
Ron Adam wrote: > Ron Adam wrote: > >> An alternative I thought of this morning is to reuse the alignment symbols >> '^', '+', and '-' and require a minimum width if a maximum width is >> specified. > > One more (or two) additions to this... (snipped) I've kind of lost track of what the prop

Re: [Python-3000] More PEP 3101 changes incoming

2007-08-04 Thread Ron Adam
Guido van Rossum wrote: > On 8/4/07, Greg Ewing <[EMAIL PROTECTED]> wrote: >> Ron Adam wrote: >>> Which would result in a first column that right aligns, a second column >>> that centers unless the value is longer than 100, in which case it right >>> align, and cuts the end, and a third column th