Re: [Python-Dev] [ssl] The weird case of IDNA

2017-12-29 Thread Guido van Rossum
This being a security issue I think it's okay to break 3.6. might even backport to 3.5 if it's easy? On Dec 29, 2017 1:59 PM, "Christian Heimes" wrote: > Hi, > > tl;dr > This mail is about internationalized domain names and TLS/SSL. It > doesn't concern you if you live in ASCII-land. Me and a co

Re: [Python-Dev] Is static typing still optional?

2017-12-29 Thread Nick Coghlan
On 30 December 2017 at 11:48, Ned Batchelder wrote: > On 12/29/17 1:59 PM, Guido van Rossum wrote: >> >> Regarding whether this should live on PyPI first, in this case that would >> not be helpful, since attrs is already the category killer on PyPI. So we >> are IMO taking the best course possible

Re: [Python-Dev] Concerns about method overriding and subclassing with dataclasses

2017-12-29 Thread Ethan Smith
Okay, I think Guido's proposal is a good compromise. I already have a branch of dataclasses that should implement that behavior, so perhaps it was meant to be. :) ~>Ethan Smith On Fri, Dec 29, 2017 at 5:13 PM, Nick Coghlan wrote: > > > On 30 Dec. 2017 11:01 am, "Ethan Smith" wrote: > > > > On

Re: [Python-Dev] Is static typing still optional?

2017-12-29 Thread Ned Batchelder
On 12/29/17 1:59 PM, Guido van Rossum wrote: Regarding whether this should live on PyPI first, in this case that would not be helpful, since attrs is already the category killer on PyPI. So we are IMO taking the best course possible given that we want something in the stdlib but not exactly att

Re: [Python-Dev] Concerns about method overriding and subclassing with dataclasses

2017-12-29 Thread Nick Coghlan
On 30 Dec. 2017 11:01 am, "Ethan Smith" wrote: On Fri, Dec 29, 2017 at 4:52 PM, Guido van Rossum wrote: > I still think it should overrides anything that's just inherited but > nothing that's defined in the class being decorated. > > Could you explain why you are of this opinion? Is it a conc

Re: [Python-Dev] Concerns about method overriding and subclassing with dataclasses

2017-12-29 Thread Guido van Rossum
No, I am concerned about the rule being too complex to explain, and about surprising effects when the base changes (action at a distance). I also don't necessarily think "we all agree" that what attrs does is wrong, but the rule I propose seems reasonable. On Dec 29, 2017 5:58 PM, "Ethan Smith"

Re: [Python-Dev] Concerns about method overriding and subclassing with dataclasses

2017-12-29 Thread Ethan Furman
On Fri, Dec 29, 2017 at 12:30 PM, Ethan Furman wrote: > Good point. So auto-generate a new __repr__ if: > > - one is not provided, and > - existing __repr__ is either: > - object.__repr__, or > - a previous dataclass __repr__ > > And if the auto default doesn't work for one's use-case, use th

Re: [Python-Dev] Concerns about method overriding and subclassing with dataclasses

2017-12-29 Thread Ethan Smith
On Fri, Dec 29, 2017 at 4:52 PM, Guido van Rossum wrote: > I still think it should overrides anything that's just inherited but > nothing that's defined in the class being decorated. > > Could you explain why you are of this opinion? Is it a concern about complexity of implementation? > On Dec

Re: [Python-Dev] Concerns about method overriding and subclassing with dataclasses

2017-12-29 Thread Ethan Smith
attrs just silently overwrites any user provided __repr__ unless you provide repr=False to attr.s. I think we can all agree that if nothing else, silently overwriting unconditionally is not what we want for dataclasses. On Fri, Dec 29, 2017 at 4:38 PM, Nathaniel Smith wrote: > On Fri, Dec 29, 2

Re: [Python-Dev] Concerns about method overriding and subclassing with dataclasses

2017-12-29 Thread Guido van Rossum
I still think it should overrides anything that's just inherited but nothing that's defined in the class being decorated. On Dec 29, 2017 5:43 PM, "Nathaniel Smith" wrote: > On Fri, Dec 29, 2017 at 12:30 PM, Ethan Furman wrote: > > Good point. So auto-generate a new __repr__ if: > > > > - one

Re: [Python-Dev] Concerns about method overriding and subclassing with dataclasses

2017-12-29 Thread Nathaniel Smith
On Fri, Dec 29, 2017 at 12:30 PM, Ethan Furman wrote: > Good point. So auto-generate a new __repr__ if: > > - one is not provided, and > - existing __repr__ is either: > - object.__repr__, or > - a previous dataclass __repr__ > > And if the auto default doesn't work for one's use-case, use th

Re: [Python-Dev] Concerns about method overriding and subclassing with dataclasses

2017-12-29 Thread Ethan Smith
On Fri, Dec 29, 2017 at 12:30 PM, Ethan Furman wrote: > On 12/29/2017 11:55 AM, Ethan Smith wrote: > >> On Fri, Dec 29, 2017 at 11:37 AM, Ethan Furman wrote: >> > > It is possible to determine whether an existing __repr__ is from 'object' >>> >> >> or not, and only provide one if that is the case

[Python-Dev] [ssl] The weird case of IDNA

2017-12-29 Thread Christian Heimes
Hi, tl;dr This mail is about internationalized domain names and TLS/SSL. It doesn't concern you if you live in ASCII-land. Me and a couple of other developers like to change the ssl module in a backwards-incompatible way to fix IDN support for TLS/SSL. Simply speaking the IDNA standards (interna

Re: [Python-Dev] Concerns about method overriding and subclassing with dataclasses

2017-12-29 Thread Ethan Furman
On 12/29/2017 11:55 AM, Ethan Smith wrote: On Fri, Dec 29, 2017 at 11:37 AM, Ethan Furman wrote: It is possible to determine whether an existing __repr__ is from 'object' >> or not, and only provide one if that is the case. I think that should be >> the default, with 'repr = True' for those

Re: [Python-Dev] Concerns about method overriding and subclassing with dataclasses

2017-12-29 Thread Ethan Smith
On Fri, Dec 29, 2017 at 11:37 AM, Ethan Furman wrote: > On 12/29/2017 02:23 AM, Ethan Smith wrote: > > The first is that needing both a keyword and method is duplicative and >> unnecessary. Eric agreed it was a hassle, but >> felt it was justified considering someone may accidentally override a >

Re: [Python-Dev] Concerns about method overriding and subclassing with dataclasses

2017-12-29 Thread Ethan Furman
On 12/29/2017 02:23 AM, Ethan Smith wrote: The first is that needing both a keyword and method is duplicative and unnecessary. Eric agreed it was a hassle, but felt it was justified considering someone may accidentally override a dataclass method. I disagree with this point of view as dataclas

Re: [Python-Dev] Concerns about method overriding and subclassing with dataclasses

2017-12-29 Thread Antoine Pitrou
On Fri, 29 Dec 2017 11:12:11 -0800 Ethan Smith wrote: > > > Agreed as well. If I make the effort of having a dataclass inherit > > from a base class, I probably don't want the base class' methods to be > > silently overriden by machine-generated methods. Of course, that can > > be worked around

Re: [Python-Dev] Concerns about method overriding and subclassing with dataclasses

2017-12-29 Thread Guido van Rossum
But you always inherit __repr__, from object. The base class might also itself be a dataclass. I think it should only skip when the decorated class itself defines __repr__. On Dec 29, 2017 3:47 AM, "Antoine Pitrou" wrote: > On Fri, 29 Dec 2017 02:23:56 -0800 > Ethan Smith wrote: > > > > In a fe

Re: [Python-Dev] Concerns about method overriding and subclassing with dataclasses

2017-12-29 Thread Ethan Smith
On Fri, Dec 29, 2017 at 2:45 AM, Antoine Pitrou wrote: > On Fri, 29 Dec 2017 02:23:56 -0800 > Ethan Smith wrote: > > > > In a few cases I want to override the repr of the AST nodes. I wrote a > > __repr__ and ran the code but lo and behold I got a type error. I > couldn't > > override it. I quic

Re: [Python-Dev] Is static typing still optional?

2017-12-29 Thread Guido van Rossum
On Fri, Dec 29, 2017 at 7:10 AM, Stephen J. Turnbull < turnbull.stephen...@u.tsukuba.ac.jp> wrote: > Recently a question has been raised about the decorator overriding > methods defined in the class (especially __repr__). People feel that > if the class defines a method, the decorator should not

Re: [Python-Dev] Supporting functools.singledispatch with classes.

2017-12-29 Thread Ethan Smith
On Fri, Dec 29, 2017 at 7:02 AM, Nick Coghlan wrote: > On 28 December 2017 at 04:22, Ethan Smith wrote: > > Okay, if there is no further feedback, I will work on a > singledispatchmethod > > decorator like partialmethod. > > > > For the future perhaps, would it not be possible to tell that the p

[Python-Dev] Summary of Python tracker Issues

2017-12-29 Thread Python tracker
ACTIVITY SUMMARY (2017-12-22 - 2017-12-29) Python tracker at https://bugs.python.org/ To view or respond to any of the issues listed below, click on the issue. Do NOT respond to this message. Issues counts and deltas: open6355 (+13) closed 37843 (+24) total 44198 (+37) Open issues wi

Re: [Python-Dev] Is static typing still optional?

2017-12-29 Thread Stephen J. Turnbull
Brett Cannon writes: > I wouldn't characterize it as "big questions". For some people there's a > question as to how to make them work without type hints, but otherwise how > they function is settled. Recently a question has been raised about the decorator overriding methods defined in the cla

Re: [Python-Dev] Supporting functools.singledispatch with classes.

2017-12-29 Thread Nick Coghlan
On 28 December 2017 at 04:22, Ethan Smith wrote: > Okay, if there is no further feedback, I will work on a singledispatchmethod > decorator like partialmethod. > > For the future perhaps, would it not be possible to tell that the passed > argument is a descriptor/function and dispatch to the corre

Re: [Python-Dev] Is static typing still optional?

2017-12-29 Thread Stephen J. Turnbull
Brett Cannon writes: > I wouldn't characterize it as "big questions". For some people there's a > question as to how to make them work without type hints, but otherwise how > they function is settled. Recently a question has been raised about the decorator overriding methods defined in the cla

Re: [Python-Dev] Heap allocate type structs in native extension modules?

2017-12-29 Thread Hugh Fisher
> Date: Fri, 29 Dec 2017 11:25:14 +0200 > From: Serhiy Storchaka > To: python-dev@python.org > Subject: Re: [Python-Dev] Heap allocate type structs in native > extension modules? [ munch ] > Yes, you can create heap types by using PyType_FromSpecWithBases(). > > But be aware of caveats (ht

Re: [Python-Dev] Concerns about method overriding and subclassing with dataclasses

2017-12-29 Thread Antoine Pitrou
On Fri, 29 Dec 2017 02:23:56 -0800 Ethan Smith wrote: > > In a few cases I want to override the repr of the AST nodes. I wrote a > __repr__ and ran the code but lo and behold I got a type error. I couldn't > override it. I quickly learned that one needs to pass a keyword to the > dataclass decora

[Python-Dev] Where to report performance of re? [was: (no subject)]

2017-12-29 Thread Stephen J. Turnbull
Franklin? Lee writes: > On Tue, Dec 26, 2017 at 2:01 AM, Yogev Hendel wrote: > > > > I don't know if this is the right place to put this, > > but I've found the following lines of code results in an incredibly long > > processing time. > (I think the correct place is python-list. python-dev

[Python-Dev] Concerns about method overriding and subclassing with dataclasses

2017-12-29 Thread Ethan Smith
Hello all, I've recently been experimenting with dataclasses. They totally rock! A lot of the boilerplate for the AST I've designed in Python is automatically taken care of, it's really great! However, I have a few concerns about the implementation. In a few cases I want to override the repr of t

Re: [Python-Dev] Heap allocate type structs in native extension modules?

2017-12-29 Thread Serhiy Storchaka
26.12.17 12:16, Hugh Fisher пише: I have a Python program which generates the boilerplate code for native extension modules from a Python source definition. (http://bitbucket.org/hugh_fisher/fullofeels if interested.) The examples in the Python doco and the "Python Essential Reference" book all