Re: [Python-Dev] One more cherry-pick request for 3.4.0 that I'd like a little public debate on

2014-02-23 Thread Larry Hastings
On 02/22/2014 03:27 AM, Antoine Pitrou wrote: On Sat, 22 Feb 2014 01:42:57 -0600 Larry Hastings wrote: Victor has asked me to cherry-pick 180e4b678003: http://bugs.python.org/issue20320 (original issue) http://hg.python.org/cpython/rev/180e4b678003/ (checkin into trunk) http:/

Re: [Python-Dev] PEP 461: Adding % formatting to bytes and bytearray -- Final, Take 2

2014-02-23 Thread Antoine Pitrou
On Sat, 22 Feb 2014 20:48:04 -0800 Ethan Furman wrote: > On 02/22/2014 07:47 PM, Cameron Simpson wrote: > > On 22Feb2014 17:56, Ethan Furman wrote: > >> Please let me know if anything else needs tweaking. > >> [...] > >> This area of programming is characterized by a mixture of binary data and >

Re: [Python-Dev] PEP 461: Adding % formatting to bytes and bytearray -- Final, Take 2

2014-02-23 Thread Antoine Pitrou
On Sat, 22 Feb 2014 17:56:50 -0800 Ethan Furman wrote: > > ``%a`` will call :func:``ascii()`` on the interpolated value's > :func:``repr()``. > This is intended as a debugging aid, rather than something that should be used > in production. Non-ascii values will be encoded to either ``\xnn`` or

Re: [Python-Dev] PEP 461: Adding % formatting to bytes and bytearray -- Final, Take 2

2014-02-23 Thread Victor Stinner
Hi, First, this is a warning in reST syntax: System Message: WARNING/2 (pep-0461.txt, line 53) > This area of programming is characterized by a mixture of binary data and > ASCII compatible segments of text (aka ASCII-encoded text). Bringing back a > restricted %-interpolation for ``bytes`` and

Re: [Python-Dev] PEP 461: Adding % formatting to bytes and bytearray -- Final, Take 2

2014-02-23 Thread Cameron Simpson
On 23Feb2014 16:31, Nick Coghlan wrote: > On 23 February 2014 13:47, Cameron Simpson wrote: > > On 22Feb2014 17:56, Ethan Furman wrote: > >> Please let me know if anything else needs tweaking. > >> [...] > >> This area of programming is characterized by a mixture of binary data and > >> ASCII co

Re: [Python-Dev] PEP 461: Adding % formatting to bytes and bytearray -- Final, Take 2

2014-02-23 Thread Cameron Simpson
On 23Feb2014 12:30, Victor Stinner wrote: > > All the numeric formatting codes (such as ``%x``, ``%o``, ``%e``, ``%f``, > > ``%g``, etc.) will be supported, and will work as they do for str, including > > the padding, justification and other related modifiers. > > IMO you should give the exhausti

Re: [Python-Dev] PEP 463: Exception-catching expressions

2014-02-23 Thread Isaac Morland
On Sun, 23 Feb 2014, Nick Coghlan wrote: Note that mandatory parentheses means we can duck the precedence question entirely, which I count as another point in favour of requiring them :) Careful, if you take that too far then Python 4 will have to be Scheme. ;-) Isaac Morland

Re: [Python-Dev] PEP 461: Adding % formatting to bytes and bytearray -- Final, Take 2

2014-02-23 Thread Nikolaus Rath
Ethan Furman writes: > Example:: > >>>> b'%4x' % 10 >b' a' > >>>> '%#4x' % 10 >' 0xa' > >>>> '%04X' % 10 >'000A' Shouldn't the second two examples also be bytes, ie. b'%#4x' instead of '%#4x'? Best, -Nikolaus -- Encrypted emails preferred. PGP fingerprint: 5B93 61F8

[Python-Dev] [RELEASED] Python 3.3.5 release candidate 1

2014-02-23 Thread Georg Brandl
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On behalf of the Python development team, I'm happy to announce the release of Python 3.3.5, release candidate 1. Python 3.3.5 includes a fix for a regression in zipimport in 3.3.4 (see http://bugs.python.org/issue20621) and a few other bugs. Python

Re: [Python-Dev] PEP 463: Exception-catching expressions

2014-02-23 Thread Stefan Behnel
Chris Angelico, 21.02.2014 04:15: > Just as PEP 308 introduced a means of value-based conditions in an > expression, this system allows exception-based conditions to be used > as part of an expression. > [...] > This currently works:: > > lst = [1, 2, None, 3] > value = lst[2] or "No value

Re: [Python-Dev] PEP 463: Exception-catching expressions

2014-02-23 Thread Stefan Behnel
Stefan Behnel, 23.02.2014 19:51: > Cython has typed > assignments, so a straight forward idea would be to handle TypeErrors in > assignments like this: > > cdef str s > s = x except TypeError: str(x) Similar code in Python would be this: from array import array x = array('i', [1,

Re: [Python-Dev] PEP 463: Exception-catching expressions

2014-02-23 Thread Thomas Wouters
On Feb 23, 2014 7:52 PM, "Stefan Behnel" wrote: > > Chris Angelico, 21.02.2014 04:15: > > Just as PEP 308 introduced a means of value-based conditions in an > > expression, this system allows exception-based conditions to be used > > as part of an expression. > > [...] > > This currently works:: >

Re: [Python-Dev] PEP 461: Adding % formatting to bytes and bytearray -- Final, Take 2

2014-02-23 Thread Ethan Furman
On 02/23/2014 03:31 AM, Antoine Pitrou wrote: On Sat, 22 Feb 2014 20:48:04 -0800 Ethan Furman wrote: All the numeric formatting codes (such as ``%x``, ``%o``, ``%e``, ``%f``, ``%g``, etc.) will be supported, and will work as they do for str, including the padding, justification and other relate

Re: [Python-Dev] PEP 461: Adding % formatting to bytes and bytearray -- Final, Take 2

2014-02-23 Thread Ethan Furman
On 02/22/2014 10:50 PM, Nikolaus Rath wrote: Ethan Furman writes: Example:: >>> b'%4x' % 10 b' a' >>> '%#4x' % 10 ' 0xa' >>> '%04X' % 10 '000A' Shouldn't the second two examples also be bytes, ie. b'%#4x' instead of '%#4x'? Yup, thanks. -- ~Ethan~ _

Re: [Python-Dev] PEP 461: Adding % formatting to bytes and bytearray -- Final, Take 2

2014-02-23 Thread Ethan Furman
On 02/23/2014 03:33 AM, Antoine Pitrou wrote: On Sat, 22 Feb 2014 17:56:50 -0800 Ethan Furman wrote: ``%a`` will call :func:``ascii()`` on the interpolated value's :func:``repr()``. This is intended as a debugging aid, rather than something that should be used in production. Non-ascii values

Re: [Python-Dev] PEP 461: Adding % formatting to bytes and bytearray -- Final, Take 2

2014-02-23 Thread Ethan Furman
On 02/23/2014 03:30 AM, Victor Stinner wrote: First, this is a warning in reST syntax: System Message: WARNING/2 (pep-0461.txt, line 53) Yup, fixed that. This area of programming is characterized by a mixture of binary data and ASCII compatible segments of text (aka ASCII-encoded text). B

Re: [Python-Dev] PEP 461: Adding % formatting to bytes and bytearray -- Final, Take 2

2014-02-23 Thread Antoine Pitrou
On Sun, 23 Feb 2014 12:42:59 -0800 Ethan Furman wrote: > On 02/23/2014 03:33 AM, Antoine Pitrou wrote: > > On Sat, 22 Feb 2014 17:56:50 -0800 > > Ethan Furman wrote: > >> > >> ``%a`` will call :func:``ascii()`` on the interpolated value's > >> :func:``repr()``. > >> This is intended as a debuggi

Re: [Python-Dev] PEP 463: Exception-catching expressions

2014-02-23 Thread Ethan Furman
On 02/23/2014 11:26 AM, Thomas Wouters wrote: On Feb 23, 2014 7:52 PM, "Stefan Behnel" mailto:stefan...@behnel.de>> wrote: Chris Angelico, 21.02.2014 04:15: > Just as PEP 308 introduced a means of value-based conditions in an > expression, this system allows exception-based conditions to be us

Re: [Python-Dev] PEP 463: Exception-catching expressions

2014-02-23 Thread Chris Angelico
On Mon, Feb 24, 2014 at 6:26 AM, Thomas Wouters wrote: >> I see a risk of interfering with in-place assignment operators, e.g. >> >> x /= y except ZeroDivisionError: 1 >> >> might not do what one could expect, because (as I assume) it would behave >> differently from >> >> x = x / y except

Re: [Python-Dev] PEP 461: Adding % formatting to bytes and bytearray -- Final, Take 2

2014-02-23 Thread Victor Stinner
> > >>> >> (You forgot "/U" representation (it's an antislah, but I don't >> see the key on my Mac keyboard?).) >> > > Hard to forget what you don't know. ;) Will ascii() ever emit an > antislash representation? Try ascii(chr(0x1f)). What is the use case of this *new* formatter? H

Re: [Python-Dev] PEP 461: Adding % formatting to bytes and bytearray -- Final, Take 2

2014-02-23 Thread Antoine Pitrou
On Sun, 23 Feb 2014 14:14:55 -0800 Glenn Linderman wrote: > On 2/23/2014 1:37 PM, Antoine Pitrou wrote: > > And you certainly*don't* print debugging output into a wire protocol. > > Web server applications do, so they can be displayed in the browser. They may embed debugging information into so

Re: [Python-Dev] PEP 461: Adding % formatting to bytes and bytearray -- Final, Take 2

2014-02-23 Thread Glenn Linderman
On 2/23/2014 1:37 PM, Antoine Pitrou wrote: And you certainly*don't* print debugging output into a wire protocol. Web server applications do, so they can be displayed in the browser. ___ Python-Dev mailing list Python-Dev@python.org https://mail.pyth

Re: [Python-Dev] PEP 461: Adding % formatting to bytes and bytearray -- Final, Take 2

2014-02-23 Thread Nick Coghlan
On 24 Feb 2014 07:39, "Antoine Pitrou" wrote: > > On Sun, 23 Feb 2014 12:42:59 -0800 > Ethan Furman wrote: > > On 02/23/2014 03:33 AM, Antoine Pitrou wrote: > > > On Sat, 22 Feb 2014 17:56:50 -0800 > > > Ethan Furman wrote: > > >> > > >> ``%a`` will call :func:``ascii()`` on the interpolated val

Re: [Python-Dev] PEP 461: Adding % formatting to bytes and bytearray -- Final, Take 2

2014-02-23 Thread Cameron Simpson
On 23Feb2014 22:56, Victor Stinner wrote: > > An aid to debugging -- need to see what's what at that moment? Toss it > > into %a. It is not intended for production code, but is included to > > hopefully circumvent the inappropriate use of __bytes__ methods on classes. > > How do you plan to use

Re: [Python-Dev] PEP 461: Adding % formatting to bytes and bytearray -- Final, Take 2

2014-02-23 Thread Antoine Pitrou
On Mon, 24 Feb 2014 08:54:08 +1000 Nick Coghlan wrote: > > > The idea being if we offer %a, folks won't be tempted to abuse > __bytes__. > > > > Which folks are we talking about? This sounds gratuitous. > > It's a harm containment tactic, based on the assumption people *will* want > to include th

Re: [Python-Dev] PEP 461: Adding % formatting to bytes and bytearray -- Final, Take 2

2014-02-23 Thread Eric V. Smith
On 2/23/2014 4:25 PM, Ethan Furman wrote: > I agree that having only one decimal format code would be nice, or even > two if the second one did something different, and that three seems > completely over the top -- unfortunately, Python 3.4 still supports all > three (%d, %i, and %u). Not supportin

Re: [Python-Dev] PEP 461: Adding % formatting to bytes and bytearray -- Final, Take 2

2014-02-23 Thread Glenn Linderman
On 2/23/2014 2:25 PM, Antoine Pitrou wrote: On Sun, 23 Feb 2014 14:14:55 -0800 Glenn Linderman wrote: On 2/23/2014 1:37 PM, Antoine Pitrou wrote: And you certainly*don't* print debugging output into a wire protocol. Web server applications do, so they can be displayed in the browser. They m

Re: [Python-Dev] PEP 463: Exception-catching expressions

2014-02-23 Thread Jan Kaliszewski
23.02.2014 19:51, Stefan Behnel wrote: I see a risk of interfering with in-place assignment operators, e.g. x /= y except ZeroDivisionError: 1 might not do what one could expect, because (as I assume) it would behave differently from x = x / y except ZeroDivisionError: 1 [snip] Pl

Re: [Python-Dev] PEP 463: Exception-catching expressions

2014-02-23 Thread Chris Angelico
On Mon, Feb 24, 2014 at 7:51 AM, Ethan Furman wrote: >> Yes. Augmented assignment is still assignment, so a statement. The only >> way to parse that is as >> >> x /= (y except ZeroDivisionError: 1) > > > Well, that is certainly not what I would have expected. I can see that you'd want to have tha

Re: [Python-Dev] PEP 461: Adding % formatting to bytes and bytearray -- Final, Take 2

2014-02-23 Thread Stephen J. Turnbull
Glenn Linderman writes: > On 2/23/2014 2:25 PM, Antoine Pitrou wrote: >> On Sun, 23 Feb 2014 14:14:55 -0800 Glenn Linderman >> wrote: >>> On 2/23/2014 1:37 PM, Antoine Pitrou wrote: And you certainly*don't* print debugging output into a wire protocol. >>> Web server applications do,

Re: [Python-Dev] PEP 461: Adding % formatting to bytes and bytearray -- Final, Take 2

2014-02-23 Thread Nick Coghlan
On 24 February 2014 08:56, Cameron Simpson wrote: > On 23Feb2014 22:56, Victor Stinner wrote: >> > An aid to debugging -- need to see what's what at that moment? Toss it >> > into %a. It is not intended for production code, but is included to >> > hopefully circumvent the inappropriate use of _

[Python-Dev] [RELEASED] Python 3.4.0 release candidate 2 is now available

2014-02-23 Thread Larry Hastings
On behalf of the Python development team, I'm delighted to announce the second and final release candidate of Python 3.4. This is a preview release, and its use is not recommended for production settings. Python 3.4 includes a range of improvements of the 3.x series, including hundreds of smal