Re: [Python-3000] Proposed new language for newline parameter to TextIOBase

2007-08-15 Thread Brett Cannon
On 8/14/07, Guido van Rossum <[EMAIL PROTECTED]> wrote: > I thought some more about the universal newlines situation, and I > think I can handle all the use cases with a single 'newline' > parameter. The use cases are: > > (A) input use cases: > > (1) newline=None: input with default universal newl

[Python-3000] PEP 3131 is implemented

2007-08-15 Thread Martin v. Löwis
I just implemented PEP 3131 (non-ASCII identifiers). There are several problems with displaying error messages, in particular when the terminal cannot render the string; if anybody wants to work on this, please go ahead. Regards, Martin ___ Python-3000

Re: [Python-3000] PEP 3101 Updated

2007-08-15 Thread Eric Smith
Talin wrote: > A new version is up, incorporating material from the various discussions > on this list: > > http://www.python.org/dev/peps/pep-3101/ I have a number of parts of this implemented. I'm refactoring the original PEP 3101 sandbox code to get it working. Mostly it involves un

Re: [Python-3000] Proposed new language for newline parameter to TextIOBase

2007-08-15 Thread Barry Warsaw
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Aug 15, 2007, at 3:47 AM, Brett Cannon wrote: > On 8/14/07, Guido van Rossum <[EMAIL PROTECTED]> wrote: >> I thought some more about the universal newlines situation, and I >> think I can handle all the use cases with a single 'newline' >> paramete

Re: [Python-3000] PEP 3131 is implemented

2007-08-15 Thread Barry Warsaw
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Aug 15, 2007, at 4:37 AM, Martin v. Löwis wrote: > I just implemented PEP 3131 (non-ASCII identifiers). > > There are several problems with displaying error messages, > in particular when the terminal cannot render the string; > if anybody wants to

Re: [Python-3000] Proposed new language for newline parameter to TextIOBase

2007-08-15 Thread Christian Heimes
Brett Cannon wrote: > I like the options, but I would swap the meaning of None and the empty > string. My reasoning for this is that for option 3 it says to me > "here is a string representing EOL, and make it \n". So I would think > of the empty string as, "I don't know what EOL is, but I want i

Re: [Python-3000] Proposed new language for newline parameter to TextIOBase

2007-08-15 Thread Georg Brandl
Brett Cannon schrieb: > On 8/14/07, Guido van Rossum <[EMAIL PROTECTED]> wrote: >> I thought some more about the universal newlines situation, and I >> think I can handle all the use cases with a single 'newline' >> parameter. The use cases are: >> >> (A) input use cases: >> >> (1) newline=None: in

Re: [Python-3000] Documentation switch imminent

2007-08-15 Thread Georg Brandl
Brett Cannon schrieb: > On 8/14/07, Georg Brandl <[EMAIL PROTECTED]> wrote: >> Now that the converted documentation is fairly bug-free, I want to >> make the switch. >> >> I will replace the old Doc/ trees in the trunk and py3k branches >> tomorrow, moving over the reST ones found at >> svn+ssh://s

Re: [Python-3000] Documentation switch imminent

2007-08-15 Thread Georg Brandl
Georg Brandl schrieb: > Now that the converted documentation is fairly bug-free, I want to > make the switch. > > I will replace the old Doc/ trees in the trunk and py3k branches > tomorrow, moving over the reST ones found at > svn+ssh://svn.python.org/doctools/Doc-{26,3k}. > > Neal will change h

Re: [Python-3000] PEP 3101 Updated

2007-08-15 Thread James Thiele
I think the example: "My name is {0.name}".format(file('out.txt')) Would be easier to understand if you added: Which would produce: "My name is 'out.txt'" On 8/14/07, Talin <[EMAIL PROTECTED]> wrote: > A new version is up, incorporating material from the various discussions > on

Re: [Python-3000] PEP 3101 Updated

2007-08-15 Thread James Thiele
The section on the explicit conversion flag contains the following line: These flags are typically placed before the format specifier: Where else can they be placed? Also there is no description of what action (if any) is taken if an unknown explicit conversion flag is encoubtered. On 8/1

Re: [Python-3000] Proposed new language for newline parameter to TextIOBase

2007-08-15 Thread Fred Drake
On Aug 15, 2007, at 9:28 AM, Christian Heimes wrote: > I like to propose some constants which should be used instead of the > strings: +1 for this. This should make code easier to read, too; not everyone spends time with line-oriented I/O, and the strings are just magic numbers in that case.

Re: [Python-3000] Proposed new language for newline parameter to TextIOBase

2007-08-15 Thread Steven Bethard
On 8/15/07, Georg Brandl <[EMAIL PROTECTED]> wrote: > I'd use None and "\r"/... as proposed, but "U" instead of the empty string > for universal newline mode. I know that "U" already has this meaning as a differently named parameter, but if I saw something like:: open(file_name, newline='U')

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

2007-08-15 Thread Jim Jewett
On 8/14/07, Ron Adam <[EMAIL PROTECTED]> wrote: > Jim Jewett wrote: > > On 8/13/07, Ron Adam <[EMAIL PROTECTED]> wrote: > >>{name[:][type][alignment_term][,content_modifying_term]} > > ... You used the (alignment term) > > width as the number of digits before the decimal, > > instead of

Re: [Python-3000] Proposed new language for newline parameter to TextIOBase

2007-08-15 Thread Barry Warsaw
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Aug 15, 2007, at 9:28 AM, Christian Heimes wrote: > I like to propose some constants which should be used instead of the > strings: > > MAC = '\r' > UNIX = '\n' > WINDOWS = '\r\n' > UNIVERSAL = '' > NOTRANSLATE = None > > I think that open(filename

Re: [Python-3000] PEP 3101 Updated

2007-08-15 Thread Eric Smith
James Thiele wrote: > I think the example: > > "My name is {0.name}".format(file('out.txt')) > > Would be easier to understand if you added: > > Which would produce: > > "My name is 'out.txt'" I agree. Also, the example a couple of paragraphs down: "My name is {0[name]}".format(di

Re: [Python-3000] Documentation switch imminent

2007-08-15 Thread Brett Cannon
On 8/15/07, Georg Brandl <[EMAIL PROTECTED]> wrote: > Brett Cannon schrieb: > > On 8/14/07, Georg Brandl <[EMAIL PROTECTED]> wrote: > >> Now that the converted documentation is fairly bug-free, I want to > >> make the switch. > >> > >> I will replace the old Doc/ trees in the trunk and py3k branche

Re: [Python-3000] Format specifier proposal

2007-08-15 Thread Adam Olsen
On 8/15/07, Ron Adam <[EMAIL PROTECTED]> wrote: > > > Andrew James Wade wrote: > > On Tue, 14 Aug 2007 21:12:32 -0500 > > Ron Adam <[EMAIL PROTECTED]> wrote: > > >> What I was thinking of was just a simple left to right evaluation order. > >> > >> "{0:spec1, spec2, ... }".format(x) > >> > >> I

Re: [Python-3000] Proposed new language for newline parameter to TextIOBase

2007-08-15 Thread Guido van Rossum
On 8/14/07, Guido van Rossum <[EMAIL PROTECTED]> wrote: > I thought some more about the universal newlines situation, and I > think I can handle all the use cases with a single 'newline' > parameter. The use cases are: > > (A) input use cases: > > (1) newline=None: input with default universal newl

Re: [Python-3000] PEP 3101 Updated

2007-08-15 Thread Eric Smith
James Thiele wrote: > The section on the explicit conversion flag contains the following line: > > These flags are typically placed before the format specifier: > > Where else can they be placed? I'd like this to say they can only be placed where the PEP describes them, or maybe to be onl

Re: [Python-3000] Proposed new language for newline parameter to TextIOBase

2007-08-15 Thread Adam Olsen
On 8/15/07, Christian Heimes <[EMAIL PROTECTED]> wrote: > Brett Cannon wrote: > > I like the options, but I would swap the meaning of None and the empty > > string. My reasoning for this is that for option 3 it says to me > > "here is a string representing EOL, and make it \n". So I would think >

Re: [Python-3000] Fix imghdr module for bytes

2007-08-15 Thread Joel Bender
Greg Ewing wrote: > I'm wondering whether we want a "byte character literal" > to go along with "byte string literals": > >h[0] == c"P" > > After all, if it makes sense to write an array of bytes > as though they were ASCII characters, it must make sense > to write a single byte that way as

Re: [Python-3000] Documentation switch imminent

2007-08-15 Thread Martin v. Löwis
> Okay, I made the switch. I tagged the state of both Python branches > before the switch as tags/py{26,3k}-before-rstdocs/. Update instructions: 1. svn diff Doc; any pending changes will need to be redone 2. svn up; this will remove the tex sources, and then likely fail if there were still o

Re: [Python-3000] Proposed new language for newline parameter to TextIOBase

2007-08-15 Thread Tony Lownds
On Aug 14, 2007, at 9:56 PM, Guido van Rossum wrote: > I thought some more about the universal newlines situation, and I > think I can handle all the use cases with a single 'newline' > parameter. The use cases are: > > (A) input use cases: > > (1) newline=None: input with default universal newli

Re: [Python-3000] Questions about email bytes/str (python 3000)

2007-08-15 Thread Victor Stinner
On Wednesday 15 August 2007 03:44:54 Bill Janssen wrote: > > (...) I think that base64MIME.encode() may have to accept strings. > > Personally, I think it would avoid more errors if it didn't. Yeah, how can you guess which charset the user want to use? For most user, there is only one charset: la

Re: [Python-3000] Proposed new language for newline parameter to TextIOBase

2007-08-15 Thread Adam Olsen
On 8/14/07, Guido van Rossum <[EMAIL PROTECTED]> wrote: > I thought some more about the universal newlines situation, and I > think I can handle all the use cases with a single 'newline' > parameter. The use cases are: > > (A) input use cases: > > (1) newline=None: input with default universal newl

Re: [Python-3000] Proposed new language for newline parameter to TextIOBase

2007-08-15 Thread Adam Olsen
On 8/15/07, Guido van Rossum <[EMAIL PROTECTED]> wrote: > On 8/15/07, Adam Olsen <[EMAIL PROTECTED]> wrote: > > On 8/14/07, Guido van Rossum <[EMAIL PROTECTED]> wrote: > > > (2) newline='': input with untranslated universal newlines mode; lines > > > may end in \r, \n, or \r\n, and these are return

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

2007-08-15 Thread Ron Adam
Jim Jewett wrote: > On 8/14/07, Ron Adam <[EMAIL PROTECTED]> wrote: >> Jim Jewett wrote: >>> On 8/13/07, Ron Adam <[EMAIL PROTECTED]> wrote: > {name[:][type][alignment_term][,content_modifying_term]} > >>> ... You used the (alignment term) >>> width as the number of digits before t

Re: [Python-3000] Proposed new language for newline parameter to TextIOBase

2007-08-15 Thread Guido van Rossum
On 8/15/07, Adam Olsen <[EMAIL PROTECTED]> wrote: > On 8/14/07, Guido van Rossum <[EMAIL PROTECTED]> wrote: > > (2) newline='': input with untranslated universal newlines mode; lines > > may end in \r, \n, or \r\n, and these are returned untranslated. > > Caveat: this mode cannot be supported by so

[Python-3000] Change in sys.stdin.name

2007-08-15 Thread Eric Smith
I mentioned this in another message, but I thought I'd mention it here. I see this change in the behavior of sys.stdin.name, between 2.3.3 and 3.0x (checked out a few minutes ago). $ python Python 2.3.3 (#1, May 7 2004, 10:31:40) [GCC 3.3.3 20040412 (Red Hat Linux 3.3.3-7)] on linux2 Type "help

Re: [Python-3000] [Python-Dev] Documentation switch imminent

2007-08-15 Thread Brett Cannon
On 8/15/07, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > > Okay, I made the switch. I tagged the state of both Python branches > > before the switch as tags/py{26,3k}-before-rstdocs/. > > Update instructions: > > 1. svn diff Doc; any pending changes will need to be redone > 2. svn up; this will

Re: [Python-3000] [Python-Dev] Documentation switch imminent

2007-08-15 Thread Martin v. Löwis
>> 1. svn diff Doc; any pending changes will need to be redone >> 2. svn up; this will remove the tex sources, and then likely >>fail if there were still other files present in Doc, e.g. >>from building the documentation >> 3. review any files left in Doc >> 4. rm -rf Doc >> 5. svn up >> >>

Re: [Python-3000] Format specifier proposal

2007-08-15 Thread Ron Adam
Adam Olsen wrote: > On 8/15/07, Ron Adam <[EMAIL PROTECTED]> wrote: >> >> Andrew James Wade wrote: >>> On Tue, 14 Aug 2007 21:12:32 -0500 >>> Ron Adam <[EMAIL PROTECTED]> wrote: What I was thinking of was just a simple left to right evaluation order. "{0:spec1, spec2, ... }".f

Re: [Python-3000] Format specifier proposal

2007-08-15 Thread Jim Jewett
On 8/14/07, Greg Ewing <[EMAIL PROTECTED]> wrote: > ... {foo!r} rather than {foo:!r} > But either way, I suspect I'll find it difficult > to avoid writing it as {foo:r} in the heat of the > moment. Me too. And I don't like using up the "!" character. I know that it is still available outside o

Re: [Python-3000] Questions about email bytes/str (python 3000)

2007-08-15 Thread Guido van Rossum
(Warning: quotation intentionally out of context!) On 8/15/07, somebody wrote: > For most users, there is only one charset: latin-1. Whoa! Careful with those assumptions. This is very culture and platforms dependent. For Americans it's ASCII (only half joking :-). For most of the world it's likel

Re: [Python-3000] Format specifier proposal

2007-08-15 Thread Jim Jewett
On 8/15/07, Ron Adam <[EMAIL PROTECTED]> wrote: > After each term is returned from the __format__ call, the results > __format__ method is called with the next specifier. GetTime.__format__ > returns a string. str.__format__, aligns it. A nice left to right > sequence of events. Is this a patt

Re: [Python-3000] Change in sys.stdin.name

2007-08-15 Thread Guido van Rossum
It sort of is -- the new I/O library uses the file descriptor if no filename is given. There were no unit tests that verified the old behavior, and I think it was of pretty marginal usefulness. Code inspecting f.name can tell the difference by looking at its type -- if it is an int, it's a file des

Re: [Python-3000] Change in sys.stdin.name

2007-08-15 Thread Christian Heimes
Eric Smith wrote: > Is this deliberate? I can file a bug report if need be, just let me know. I'm sure it is a bug. The site.installnewio() function doesn't set the names. The attached patch fixes the issue and adds an unit test, too. Christian Index: Lib/site.py

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

2007-08-15 Thread Greg Ewing
Ron Adam wrote: > > Greg Ewing wrote: > > The format strings are starting to look like line > > noise. > > Do you have a specific example or is it just an overall feeling? It's an overall feeling from looking at your examples. I can't take them in at a glance -- I have to minutely examine them c

Re: [Python-3000] Format specifier proposal

2007-08-15 Thread Ron Adam
Jim Jewett wrote: > On 8/15/07, Ron Adam <[EMAIL PROTECTED]> wrote: > >> After each term is returned from the __format__ call, the results >> __format__ method is called with the next specifier. GetTime.__format__ >> returns a string. str.__format__, aligns it. A nice left to right >> sequenc

Re: [Python-3000] Format specifier proposal

2007-08-15 Thread Greg Ewing
Ron Adam wrote: > What I was thinking of was just a simple left to right evaluation order. > > "{0:spec1, spec2, ... }".format(x) That would work too, as long as you were willing to forbid "," as a possible character in a type-specific format string. -- Greg Ewing, Computer Science Dept, +

Re: [Python-3000] Format specifier proposal

2007-08-15 Thread Greg Ewing
Andrew James Wade wrote: > {1:!renewal date: %Y-%m-%d} # no special meaning for ! here. Yuck. Although it might happen to work due to reuse of strftime, I'd consider that bad style -- constant parts of the output string should be outside of the format specs, i.e.: "renewal date: {1:%Y-%m-%d}".

Re: [Python-3000] [Python-Dev] Universal newlines support in Python 3.0

2007-08-15 Thread Greg Ewing
Barry Warsaw wrote: > Add a flag > called preserve_eols that defaults to False, is ignored unless > universal newline mode is turned on, Is there any reason it shouldn't work in non-universal- newlines mode too? -- Greg Ewing, Computer Science Dept, +--+ U

Re: [Python-3000] Proposed new language for newline parameter to TextIOBase

2007-08-15 Thread Greg Ewing
Christian Heimes wrote: > Besides I always forget if Windows is '\r\n' or '\n\r'. Oh, that's easy. The teletype needs to get the CR before the LF so that it can start moving the carriage back to the left while it's scrolling the paper up. What? You don't have a teletype? Well, er, in that case...

Re: [Python-3000] Proposed new language for newline parameter to TextIOBase

2007-08-15 Thread Greg Ewing
Georg Brandl wrote: > "U" instead of the empty string for universal newline mode. It would be good to leave open the possibility of allowing arbitrary line separation strings at some time in the future. In that case, newline == "U" would mean lines separated by "U". Predefined constants seem like

Re: [Python-3000] Fix imghdr module for bytes

2007-08-15 Thread Greg Ewing
Joel Bender wrote: > Would you propose these to be mutable as well? No, they'd be integers. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | Carpe post meridiem! | Christchurch, New Zealand | (I'm not a

Re: [Python-3000] Proposed new language for newline parameter to TextIOBase

2007-08-15 Thread Greg Ewing
Adam Olsen wrote: > On 8/14/07, Guido van Rossum <[EMAIL PROTECTED]> wrote: > > > (2) newline='': input with untranslated universal newlines mode; lines > > may end in \r, \n, or \r\n, and these are returned untranslated. > > Caveat: this mode cannot be supported by sockets. When reading a lone

Re: [Python-3000] Proposed new language for newline parameter to TextIOBase

2007-08-15 Thread Adam Olsen
On 8/15/07, Greg Ewing <[EMAIL PROTECTED]> wrote: > Adam Olsen wrote: > > On 8/14/07, Guido van Rossum <[EMAIL PROTECTED]> wrote: > > > > > (2) newline='': input with untranslated universal newlines mode; lines > > > may end in \r, \n, or \r\n, and these are returned untranslated. > > > > Caveat:

Re: [Python-3000] PEP 3101 Updated

2007-08-15 Thread Talin
Eric Smith wrote: > James Thiele wrote: >> The section on the explicit conversion flag contains the following line: >> >> These flags are typically placed before the format specifier: >> >> Where else can they be placed? > > I'd like this to say they can only be placed where the PEP describe

Re: [Python-3000] PEP 3101 Updated

2007-08-15 Thread Eric Smith
Talin wrote: > Eric Smith wrote: >> James Thiele wrote: >>> The section on the explicit conversion flag contains the following line: >>> >>> These flags are typically placed before the format specifier: >>> >>> Where else can they be placed? >> >> I'd like this to say they can only be placed

Re: [Python-3000] PEP 3101 Updated

2007-08-15 Thread Talin
Eric Smith wrote: > James Thiele wrote: >> I think the example: >> >> "My name is {0.name}".format(file('out.txt')) >> >> Would be easier to understand if you added: >> >> Which would produce: >> >> "My name is 'out.txt'" > > I agree. > > Also, the example a couple of paragraphs down:

Re: [Python-3000] PEP 3101 Updated

2007-08-15 Thread Talin
Eric Smith wrote: > Talin wrote: >> Eric Smith wrote: >>> James Thiele wrote: The section on the explicit conversion flag contains the following line: These flags are typically placed before the format specifier: Where else can they be placed? >>> >>> I'd like t

Re: [Python-3000] PEP 3101 Updated

2007-08-15 Thread Eric Smith
Talin wrote: > Eric Smith wrote: >> Talin wrote: >>> Guido expressed a definite preference for having them be first. >> >> I was afraid of that. Then can we say they'll always go first? Or is >> the intent really to say they can go anywhere (PEP says "typically >> placed")? > > I can revise it

Re: [Python-3000] PEP 3101 Updated

2007-08-15 Thread Alex Holkner
Talin wrote: > A new version is up, incorporating material from the various discussions > on this list: > > http://www.python.org/dev/peps/pep-3101/ I've been following this thread for a few weeks, and I believe the following issues haven't yet been addressed: The PEP abstract says this

Re: [Python-3000] PEP 3101 Updated

2007-08-15 Thread Talin
Alex Holkner wrote: > Talin wrote: >> A new version is up, incorporating material from the various discussions >> on this list: >> >> http://www.python.org/dev/peps/pep-3101/ > > I've been following this thread for a few weeks, and I believe the > following issues haven't yet been addressed

Re: [Python-3000] Documentation switch imminent

2007-08-15 Thread Neal Norwitz
On 8/15/07, Georg Brandl <[EMAIL PROTECTED]> wrote: > Georg Brandl schrieb: > > > > Neal will change his build scripts, so that the 2.6 and 3.0 devel > > documentation pages at docs.python.org will be built from these new > > trees soon. > > Okay, I made the switch. I tagged the state of both Pyth

Re: [Python-3000] Format specifier proposal

2007-08-15 Thread Andrew James Wade
On Sat, 11 Aug 2007 01:57:16 -0700 Talin <[EMAIL PROTECTED]> wrote: > Taking some ideas from the various threads, here's what I'd like to propose: > > (Assume that brackets [] means 'optional field') > >[:[type][align][sign][[0]minwidth][.precision]][/fill][!r] > > Examples: > > :f

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

2007-08-15 Thread Carl Johnson
(First, let me apologize for diving into a bike shed discussion.) There are two proposed ways to handle custom __format__ methods: > class MyInt: > def __format__(self, spec): > if int.is_int_specifier(spec): > return int(self).__format__(spec) > return "MyInt