Re: [Python-3000] Py3k_struni additional test failures under cygwin

2007-07-30 Thread Martin v. Löwis
> > Cygwin's setlocale function only supports the "C" locale. > > I am a bit suprised that ASCII is returned rather than the system's > default > > encoding. > > If I understand the situation correctly, you shouldn't be. The C > locale is defined to use ASCII. I think you don't. I'm certain

Re: [Python-3000] base64 - bytes and strings

2007-07-30 Thread James Y Knight
On Jul 30, 2007, at 1:24 PM, Guido van Rossum wrote: > I think you're missing the point, the point being that the most common > use needs bytes, so returning bytes is the most useful API design. I'd say that encoding binary data in XML is at least in the running for most common use of base64. An

Re: [Python-3000] base64 - bytes and strings

2007-07-30 Thread Greg Ewing
Ron Adam wrote: > Not extra, you just need to make sure your binary data is in the correct > range of values the text device you are sending to can handle. Does this mean that Py3k text streams will accept byte arrays in their write() methods, and that byte arrays can be concatenated with unicode

Re: [Python-3000] optimizing [x]range

2007-07-30 Thread Raymond Hettinger
>> Having done that, if I want to test whether some index j >> is within the range of indices for this sequence, it >> seems natural to write >> >>if j in r: >> ... > > Fair enough. So maybe *you* can contribute a patch? And maybe we can do the same for xrange() in Py2.6 Raymond _

Re: [Python-3000] optimizing [x]range

2007-07-30 Thread Guido van Rossum
On 7/30/07, Greg Ewing <[EMAIL PROTECTED]> wrote: > The sort of thing I have in mind is where I have a sequence > that I want to frequently iterate over the indices of, so > I do > >r = xrange(len(myseq)) > > so I can write > >for i in r: > ... > > Having done that, if I want to test w

Re: [Python-3000] io library/PEP 3116 bits

2007-07-30 Thread Greg Ewing
Guido van Rossum wrote: > I don't think \r needs to be supported -- OSX uses \n; Not always. It's still possible to come across situations where dealing with \r is necessary, when using Classic applications or OSX ports of them. I think it would be premature to drop support for \r at this stage.

Re: [Python-3000] pep 3124 plans

2007-07-30 Thread Talin
Phillip J. Eby wrote: > The principle downside to this approach is that only one metaclass > can provide a __prepare__ dictionary, which means it's even more > difficult to combine metaclasses than it is in today's Python -- > which means I want to give a little more thought to PEP 3115, to see

Re: [Python-3000] io library/PEP 3116 bits

2007-07-30 Thread Greg Ewing
[EMAIL PROTECTED] wrote: > The other thing I wanted to comment on is the default value for n in the > various read methods. In some places it's -1 (why not zero? *), Maybe because reading 0 bytes already has a well-defined (if not particularly useful) meaning? You probably wouldn't use it explic

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

2007-07-30 Thread Greg Ewing
Hasan Diwan wrote: > The issue seems to be in the socket.py close method. It needs to sleep > socket.SO_REUSEADDR seconds before returning. WHAT??? socket.SO_REUSEADDR is a flag that you pass when creating a socket to tell it to re-use an existing address, not something to be used as a timeout val

Re: [Python-3000] pep 3124 plans

2007-07-30 Thread Greg Ewing
Talin wrote: > So basically what I would propose is that we simply say that we don't > mix normal overloading and multi-method dispatch until PJE comes up with > his better solution. Maybe this should be enforced, i.e. only allow global functions and class or static methods to be GFs, not regula

Re: [Python-3000] Py3k_struni additional test failures under cygwin

2007-07-30 Thread Stephen J. Turnbull
Joe Smith writes: > Cygwin's setlocale function only supports the "C" locale. > I am a bit suprised that ASCII is returned rather than the system's default > encoding. If I understand the situation correctly, you shouldn't be. The C locale is defined to use ASCII. __

Re: [Python-3000] base64 - bytes and strings

2007-07-30 Thread Greg Ewing
Terry Reedy wrote: > On the contrary, to me, the point of base64 is to encode bytes into a > subset of bytes more or less guaranteed to not get mangled during > transport. Yes, and the way it goes about it is to map the binary data to a sequence of characters, the reasoning being that most such

Re: [Python-3000] base64 - bytes and strings

2007-07-30 Thread Greg Ewing
Talin wrote: > I believe that converting a Unicode string to a base64 encoded form is > necessarily a 2-step process. Well, yes, but only because base64 itself takes arbitrary binary data as input, not Unicode strings. Encoding *anything* other than binary data as base64 is going to require an ex

Re: [Python-3000] optimizing [x]range

2007-07-30 Thread Greg Ewing
[EMAIL PROTECTED] wrote: > Given that I find the cascading comparisons clearer I see no reason > to optimize the "in range(...)" case. The sort of thing I have in mind is where I have a sequence that I want to frequently iterate over the indices of, so I do r = xrange(len(myseq)) so I can wri

Re: [Python-3000] Py3k_struni additional test failures under cygwin

2007-07-30 Thread Martin v. Löwis
Guido van Rossum schrieb: >> I found that in many cases, this is a virus scanner or the indexing >> service interfering. They open the file, and then the test suite cannot >> delete it. > > Oh darn. I remember running into that in a completely different > context. What's the solution? Turn off the

Re: [Python-3000] pep 3124 plans

2007-07-30 Thread Phillip J. Eby
At 12:20 PM 7/27/2007 -0400, Phillip J. Eby wrote: >At 08:25 AM 7/27/2007 -0700, Guido van Rossum wrote: > >Basic GFs, great. Before/after/around, good. Other method > >combinations, fine. But GFs in classes and subclassing? Not until we > >have a much better design. > >Sounds reasonable to me. Th

Re: [Python-3000] pep 3124 plans

2007-07-30 Thread Phillip J. Eby
At 02:20 PM 7/30/2007 -0400, Jim Jewett wrote: >On 7/21/07, Phillip J. Eby <[EMAIL PROTECTED]> wrote: > > >... If you have to use @somegeneric.before and > > @somegeneric.after, you can't decide on your own to add > > @somegeneric.debug. > > > However, if it's @before(somegeneric...), then you can

Re: [Python-3000] pep 3124 plans

2007-07-30 Thread Jim Jewett
On 7/30/07, Jeffrey Yasskin <[EMAIL PROTECTED]> wrote: > On 7/29/07, Talin <[EMAIL PROTECTED]> wrote: > > Phillip J. Eby wrote: > > > At 08:25 AM 7/27/2007 -0700, Guido van Rossum wrote: > > >> ... But GFs in classes and subclassing? Not until we > > >> have a much better design. > > > The only ti

Re: [Python-3000] io library/PEP 3116 bits

2007-07-30 Thread Tony Lownds
On Jul 30, 2007, at 10:20 AM, Guido van Rossum wrote: > I don't think \r needs to be supported -- OSX uses \n; Python 3.0 > isn't going to be ported to MacOS 9. We discussed this before; I > promised I'd add \r support if anyone can find a current use case for > it. So far none have been reported.

Re: [Python-3000] pep 3124 plans

2007-07-30 Thread Jim Jewett
On 7/21/07, Phillip J. Eby <[EMAIL PROTECTED]> wrote: >... If you have to use @somegeneric.before and > @somegeneric.after, you can't decide on your own to add > @somegeneric.debug. > However, if it's @before(somegeneric...), then you can add > @debug and @authorize and @discount and whatever els

Re: [Python-3000] io library/PEP 3116 bits

2007-07-30 Thread Guido van Rossum
On 7/30/07, Tony Lownds <[EMAIL PROTECTED]> wrote: > On Jul 30, 2007, at 10:20 AM, Guido van Rossum wrote: > > I don't think \r needs to be supported -- OSX uses \n; Python 3.0 > > isn't going to be ported to MacOS 9. We discussed this before; I > > promised I'd add \r support if anyone can find a

Re: [Python-3000] Py3k_struni additional test failures under cygwin

2007-07-30 Thread Guido van Rossum
On 7/29/07, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > >> (For whats its worth, Cygwin's python 2.5 (as installed on my system) fails > >> 2 of the tests in it's version of test_mailbox.py, both with "IOError: > >> [Errno 13] Permission denied"). > > I found that in many cases, this is a virus

Re: [Python-3000] base64 - bytes and strings

2007-07-30 Thread Guido van Rossum
On 7/30/07, Blake Winton <[EMAIL PROTECTED]> wrote: > Martin v. Löwis wrote: > > The debate is whether base64.encodestring (which accepts bytes) > > should *produce* (unicode) strings, which would then have to be > > encoded as us-ascii. That would make a process of going from > > unicode to bas

Re: [Python-3000] io library/PEP 3116 bits

2007-07-30 Thread Guido van Rossum
On 7/30/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I was looking at PEP 3116 to try and figure out what the newline keyword > argument was for (it was mentioned in a couple replies to some checkin > comments and I see it in io.py). It's not really mentioned in the PEP as > far as I could t

Re: [Python-3000] struni and the Apple four-character-codes

2007-07-30 Thread Guido van Rossum
On 7/29/07, Jack Jansen <[EMAIL PROTECTED]> wrote: > One minor point (that may already have been addressed, I've not seen > the whole discussion): note that 4CCs not only occur on the Mac but > also in various other contexts: AIFF files use 4CCs to define chunk > types, MP4 files use them for a gaz

Re: [Python-3000] Py3k_struni additional test failures under cygwin

2007-07-30 Thread Joe Smith
""Martin v. Löwis"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >>> If I patch io.py to default to "utf-8" rather than using the filesystem >>> encoding (ascii), that fixes a few more things. (test_coding.py and >>> test_minidom.py) >> >> How come the filesystem decoding is set to

Re: [Python-3000] base64 - bytes and strings

2007-07-30 Thread Blake Winton
Martin v. Löwis wrote: > The debate is whether base64.encodestring (which accepts bytes) > should *produce* (unicode) strings, which would then have to be > encoded as us-ascii. That would make a process of going from > unicode to base64 bytes a three-step process: > >tosend = base64.encode

[Python-3000] io library/PEP 3116 bits

2007-07-30 Thread skip
I was looking at PEP 3116 to try and figure out what the newline keyword argument was for (it was mentioned in a couple replies to some checkin comments and I see it in io.py). It's not really mentioned in the PEP as far as I could tell other than this: Some new features include universal ne

Re: [Python-3000] struni and the Apple four-character-codes

2007-07-30 Thread Jack Jansen
One minor point (that may already have been addressed, I've not seen the whole discussion): note that 4CCs not only occur on the Mac but also in various other contexts: AIFF files use 4CCs to define chunk types, MP4 files use them for a gazillion different things (media types, codec types,

Re: [Python-3000] optimizing [x]range

2007-07-30 Thread Johan Dahlin
Guido van Rossum wrote: [..] > > Were you drunk at the time? :-) No, I just remember that I made that mistake several times. [..] > > It seems to be used quite widely already; > > > > http://google.com/codesearch?hl=en&q=+%5E.*if%5Cs%2B.*%5Cs%2Bin%5Cs%2Brange%5C(.*%24&start=10&sa=N > > > > Sorr