Re: [Python-Dev] PEP 526 ready for review: Syntax for Variable and Attribute Annotations

2016-09-01 Thread Nick Coghlan
On 2 September 2016 at 02:21, Steven D'Aprano wrote: > Unless I've missed something, there's no way to pre-declare an instance > attribute without specifying a type. (Even if that type is Any.) So how > about we allow None as a type-hint on its own: > > NAME: None None already has a meaning a

Re: [Python-Dev] PEP 528: Change Windows console encoding to UTF-8

2016-09-01 Thread Steve Dower
My original plan was to bypass the utf8 encoding step, but that was going to cause major issues with code that blindly assumes it can do things like sys.stdout.buffer.write(b"\n") (rather than b"\n\0" - and who'd imagine you needed to do that). I didn't want to set up secret handshakes either, a

Re: [Python-Dev] PEP 528: Change Windows console encoding to UTF-8

2016-09-01 Thread Random832
On Thu, Sep 1, 2016, at 18:28, Steve Dower wrote: > This is a raw (bytes) IO class that requires text to be passed encoded > with utf-8, which will be decoded to utf-16-le and passed to the Windows APIs. > Similarly, bytes read from the class will be provided by the operating > system as utf-16-le

Re: [Python-Dev] PEP 467: last round (?)

2016-09-01 Thread Victor Stinner
2016-09-02 0:04 GMT+02:00 Ethan Furman : > - `fromord` to replace the mistaken purpose of the default constructor To replace a bogus bytes(obj)? If someone writes bytes(obj) but expect to create a byte string from an integer, why not using bchr() to fix the code? Victor __

[Python-Dev] PEP 525, third round, better finalization

2016-09-01 Thread Yury Selivanov
Hi, I've spent quite a while thinking and experimenting with PEP 525 trying to figure out how to make asynchronous generators (AG) finalization reliable. I've tried to replace the callback for GCed with a callback to intercept first iteration of AGs. Turns out it's very hard to work with we

[Python-Dev] PEP 529: Change Windows filesystem encoding to UTF-8

2016-09-01 Thread Steve Dower
I'm about to be offline for a few days, so I wanted to get my current draft PEPs out for people can read and review. I don't believe there is a lot of change as a result of either PEP, but the impact of what change there is needs to be weighed against the benefits. We've already had some thor

[Python-Dev] PEP 528: Change Windows console encoding to UTF-8

2016-09-01 Thread Steve Dower
I'm about to be offline for a few days, so I wanted to get my current draft PEPs out for people can read and review. I don't believe there is a lot of change as a result of either PEP, but the impact of what change there is needs to be weighed against the benefits. If anything, I'm likely to

Re: [Python-Dev] PEP 467: last round (?)

2016-09-01 Thread Ethan Furman
On 09/01/2016 02:06 PM, Victor Stinner wrote: 2016-09-01 21:36 GMT+02:00 Ethan Furman: Abstract This PEP proposes five small adjustments to the APIs of the ``bytes`` and ``bytearray`` types to make it easier to operate entirely in the binary domain: You should add bchr() in the Abs

Re: [Python-Dev] Patch reviews

2016-09-01 Thread Victor Stinner
2016-08-31 22:31 GMT+02:00 Christian Heimes : > https://bugs.python.org/issue27744 > Add AF_ALG (Linux Kernel crypto) to socket module This patch adds a new socket.sendmsg_afalg() method on Linux. "afalg" comes from AF_ALG which means "Address Family Algorithm". It's documented as "af_alg: User-s

Re: [Python-Dev] PEP 467: last round (?)

2016-09-01 Thread Victor Stinner
2016-09-01 21:36 GMT+02:00 Ethan Furman : > Abstract > > > This PEP proposes five small adjustments to the APIs of the ``bytes`` and > ``bytearray`` types to make it easier to operate entirely in the binary > domain: You should add bchr() in the Abstract. > * Deprecate passing single in

Re: [Python-Dev] PEP 526 ready for review: Syntax for Variable and Attribute Annotations

2016-09-01 Thread Guido van Rossum
On Thu, Sep 1, 2016 at 9:30 AM, Ivan Levkivskyi wrote: > On 1 September 2016 at 18:21, Steven D'Aprano wrote: [...] >> Unless I've missed something, there's no way to pre-declare an instance >> attribute without specifying a type. (Even if that type is Any.) So how >> about we allow None as a typ

Re: [Python-Dev] PEP 526 ready for review: Syntax for Variable and Attribute Annotations

2016-09-01 Thread Guido van Rossum
On Thu, Sep 1, 2016 at 10:01 AM, Koos Zevenhoven wrote: > On Thu, Sep 1, 2016 at 5:46 PM, Guido van Rossum wrote: >> IOW, PEP 3157 is not dead yet. Indeed. >> > > PEP 3157? Is that a typo or is there such a thing somewhere? Sorry, 3107 (the original Function Annotations PEP). > [...] > I hope t

Re: [Python-Dev] PEP 526 ready for review: Syntax for Variable and Attribute Annotations

2016-09-01 Thread Guido van Rossum
On Thu, Sep 1, 2016 at 10:30 AM, Steven D'Aprano wrote: > On Tue, Aug 30, 2016 at 02:20:26PM -0700, Guido van Rossum wrote: > >> - Whether (given PEP 484's relative success) it's worth adding syntax >> for variable/attribute annotations. > > The PEP makes a good case that it does. Thanks, I agree

[Python-Dev] PEP 467: last round (?)

2016-09-01 Thread Ethan Furman
One more iteration. PEPs repo not updated yet. Changes are renaming of methods to be ``fromsize()`` and ``fromord()``, and moving ``memoryview`` to an Open Questions section. PEP: 467 Title: Minor API improvements for binary sequences Version: $Revision$ Last-Modified: $Date$ Author: Nick Co

Re: [Python-Dev] PEP 526 ready for review: Syntax for Variable and Attribute Annotations

2016-09-01 Thread Steven D'Aprano
On Tue, Aug 30, 2016 at 02:20:26PM -0700, Guido van Rossum wrote: > - Whether (given PEP 484's relative success) it's worth adding syntax > for variable/attribute annotations. The PEP makes a good case that it does. > - Whether the keyword-free syntax idea proposed here is best: > NAME: TYPE

Re: [Python-Dev] PEP 526 ready for review: Syntax for Variable and Attribute Annotations

2016-09-01 Thread Koos Zevenhoven
On Thu, Sep 1, 2016 at 5:46 PM, Guido van Rossum wrote: > On Thu, Sep 1, 2016 at 6:11 AM, Koos Zevenhoven wrote: >> While a large amount of Python programmers may not be interested in >> type hinting local variables inside functions, I can see other >> potential benefits in this. > > IOW, PEP 315

Re: [Python-Dev] PEP 526 ready for review: Syntax for Variable and Attribute Annotations

2016-09-01 Thread Ivan Levkivskyi
On 1 September 2016 at 18:21, Steven D'Aprano wrote: > The simplest way would be to say "go on, one type hint won't hurt, > there's no meaningful runtime cost, just do it". > > from typing import Any > > class X: > NAME: Any > > Since I'm not running a type checker, it doesn't matter what hin

Re: [Python-Dev] Patch reviews

2016-09-01 Thread Christian Heimes
On 2016-08-31 22:31, Christian Heimes wrote: > Hi, > > I have 7 patches for 3.6 ready for merging. The new features were > discussed on Security-SIG and reviewed by Victor or GPS. The patches > just need one final review and an ACK. The first three patches should > land in 2.7, 3.4 and 3.5, too. >

Re: [Python-Dev] PEP 526 ready for review: Syntax for Variable and Attribute Annotations

2016-09-01 Thread Steven D'Aprano
On Thu, Sep 01, 2016 at 04:11:05PM +0300, Koos Zevenhoven wrote: > Maybe it's just me, but I've always thought 'def' is Python's least > logically used keyword. It seems to come from 'define', but what is it > about 'define' that makes it relate to functions only. Convention. You can't use "def"

Re: [Python-Dev] PEP 526 ready for review: Syntax for Variable and Attribute Annotations

2016-09-01 Thread Guido van Rossum
On Thu, Sep 1, 2016 at 6:11 AM, Koos Zevenhoven wrote: > While a large amount of Python programmers may not be interested in > type hinting local variables inside functions, I can see other > potential benefits in this. IOW, PEP 3157 is not dead yet. Indeed. > When I start sketching a new class,

Re: [Python-Dev] PEP 526 ready for review: Syntax for Variable and Attribute Annotations

2016-09-01 Thread Koos Zevenhoven
On Wed, Aug 31, 2016 at 12:20 AM, Guido van Rossum wrote: > I'm happy to present PEP 526 for your collective review: > https://www.python.org/dev/peps/pep-0526/ (HTML) > https://github.com/python/peps/blob/master/pep-0526.txt (source) > > There's also an implementation ready: > https://github.com/