Re: [Python-Dev] Third and hopefully final post: PEP 557, Data Classes

2017-12-02 Thread Nick Coghlan
On 2 December 2017 at 08:15, Eric V. Smith wrote: > See https://github.com/ericvsmith/dataclasses/issues/104 for a discussion on > making order=False the default. This matches regular classes in Python 3, > which cannot be ordered. +1 for making "order=True" be explicitly opt-in. Cheers, Nick.

Re: [Python-Dev] Third and hopefully final post: PEP 557, Data Classes

2017-12-01 Thread Eric V. Smith
See https://github.com/ericvsmith/dataclasses/issues/104 for a discussion on making order=False the default. This matches regular classes in Python 3, which cannot be ordered. Eric. ___ Python-Dev mailing list Python-Dev@python.org https://mail.python

Re: [Python-Dev] Third and hopefully final post: PEP 557, Data Classes

2017-12-01 Thread Eric V. Smith
Since this is easy enough to do in your own code, and I still don't see a use case, I'll just add a note to the PEP and delete isdataclass(). Plus, you can decide for yourself how to deal with the question of returning true for classes or instances or both. I've updated the PEP and reposted i

Re: [Python-Dev] Third and hopefully final post: PEP 557, Data Classes

2017-12-01 Thread Eric V. Smith
On 11/30/2017 3:35 PM, Carl Meyer wrote: On 11/29/2017 05:02 PM, Guido van Rossum wrote: I tried to look up the discussion but didn't find much except that you flagged this as an issue. To repeat, your concern is that isdataclass() applies to *instances*, not classes, which is how Eric has desig

Re: [Python-Dev] Third and hopefully final post: PEP 557, Data Classes

2017-11-30 Thread Eric V. Smith
On 11/30/2017 7:22 PM, Eric V. Smith wrote: On 11/30/2017 1:30 PM, Brett Cannon wrote: On Thu, 30 Nov 2017 at 05:00 Eric V. Smith > wrote:     On 11/30/2017 6:59 AM, Antoine Pitrou wrote: > > Or, simply, is_dataclass_instance(), which is even longer, but

Re: [Python-Dev] Third and hopefully final post: PEP 557, Data Classes

2017-11-30 Thread Wes Turner
On Thursday, November 30, 2017, Wes Turner wrote: > Could these be things in types? > > types.ClassType > types.InstanceType > > types.DataClass > types.DataClassInstanceType (?) > types.DataClass(types.ClassType) types.DataClassInstanceType(types.InstanceType) Would be logical? > > I sent a

Re: [Python-Dev] Third and hopefully final post: PEP 557, Data Classes

2017-11-30 Thread Eric V. Smith
On 11/30/2017 1:30 PM, Brett Cannon wrote: On Thu, 30 Nov 2017 at 05:00 Eric V. Smith > wrote: On 11/30/2017 6:59 AM, Antoine Pitrou wrote: > > Or, simply, is_dataclass_instance(), which is even longer, but far more > readable thanks to explic

Re: [Python-Dev] Third and hopefully final post: PEP 557, Data Classes

2017-11-30 Thread Lukasz Langa
+1 to (3), I like the type error idea, too. I don't care much about naming... but if I were to bikeshed this, I'd go for isdataclass (like issubclass) isdatainstance (like isinstance) - Ł > On Nov 30, 2017, at 12:35 PM, Carl Meyer wrote: > > On 11/29/2017 05:02 PM, Guido van Rossum wrote: >>

Re: [Python-Dev] Third and hopefully final post: PEP 557, Data Classes

2017-11-30 Thread Carl Meyer
On 11/29/2017 05:02 PM, Guido van Rossum wrote: > I tried to look up the discussion but didn't find much except that you > flagged this as an issue. To repeat, your concern is that isdataclass() > applies to *instances*, not classes, which is how Eric has designed it, > but you worry that either th

Re: [Python-Dev] Third and hopefully final post: PEP 557, Data Classes

2017-11-30 Thread Brett Cannon
On Thu, 30 Nov 2017 at 05:00 Eric V. Smith wrote: > On 11/30/2017 6:59 AM, Antoine Pitrou wrote: > > > > Or, simply, is_dataclass_instance(), which is even longer, but far more > > readable thanks to explicit word boundaries :-) > > That actually doesn't bother me. I think this API will be used r

Re: [Python-Dev] Third and hopefully final post: PEP 557, Data Classes

2017-11-30 Thread Eric V. Smith
On 11/30/2017 6:59 AM, Antoine Pitrou wrote: Or, simply, is_dataclass_instance(), which is even longer, but far more readable thanks to explicit word boundaries :-) That actually doesn't bother me. I think this API will be used rarely, if ever. Or more realistically, it should be used rarely:

Re: [Python-Dev] Third and hopefully final post: PEP 557, Data Classes

2017-11-30 Thread Antoine Pitrou
Or, simply, is_dataclass_instance(), which is even longer, but far more readable thanks to explicit word boundaries :-) On Thu, 30 Nov 2017 10:16:58 +0100 Antoine Pitrou wrote: > isdataclass() testing for instance-ship does sound like a bug magnet to > me. > > If isdataclassinstance() is too l

Re: [Python-Dev] Third and hopefully final post: PEP 557, Data Classes

2017-11-30 Thread Serhiy Storchaka
30.11.17 03:02, Guido van Rossum пише: I tried to look up the discussion but didn't find much except that you flagged this as an issue. To repeat, your concern is that isdataclass() applies to *instances*, not classes, which is how Eric has designed it, but you worry that either through the nam

Re: [Python-Dev] Third and hopefully final post: PEP 557, Data Classes

2017-11-30 Thread Wes Turner
Sorry, this one shouldn't be "an"; " a" was correct:: ``repr``: If true (the default), an ``__repr__`` method will be generated. Note that __repr__ can be dangerous with user-supplied input because of terminal control character injection (e.g. broken syntax highlighting, \r, character set, LEDs

Re: [Python-Dev] Third and hopefully final post: PEP 557, Data Classes

2017-11-30 Thread Wes Turner
Could these be things in types? types.ClassType types.InstanceType types.DataClass types.DataClassInstanceType (?) I sent a PR with typo fixes and ``.. code:: python`` directives so that syntax highlighting works (at least on GitHub). https://github.com/python/peps/blob/master/pep-0557.rst htt

Re: [Python-Dev] Third and hopefully final post: PEP 557, Data Classes

2017-11-30 Thread Antoine Pitrou
isdataclass() testing for instance-ship does sound like a bug magnet to me. If isdataclassinstance() is too long (that's understandable), how about isdatainstance()? Regards Antoine. On Wed, 29 Nov 2017 17:02:21 -0800 Guido van Rossum wrote: > On Wed, Nov 29, 2017 at 3:51 PM, Carl Meyer wr

Re: [Python-Dev] Third and hopefully final post: PEP 557, Data Classes

2017-11-30 Thread Eric V. Smith
On 11/29/2017 6:26 PM, Eric V. Smith wrote: I've posted a new version of PEP 557, it should soon be available at https://www.python.org/dev/peps/pep-0557/. Also, I've posted version 0.2 to PyPI as dataclasses, so you can play with it on 3.6 and 3.7. Eric. ___

Re: [Python-Dev] Third and hopefully final post: PEP 557, Data Classes

2017-11-29 Thread Guido van Rossum
On Wed, Nov 29, 2017 at 3:51 PM, Carl Meyer wrote: > On 11/29/2017 03:26 PM, Eric V. Smith wrote: > > I've posted a new version of PEP 557, it should soon be available at > > https://www.python.org/dev/peps/pep-0557/. > > > > The only significant changes since the last version are: > > > > - cha

Re: [Python-Dev] Third and hopefully final post: PEP 557, Data Classes

2017-11-29 Thread Eric V. Smith
On 11/29/2017 6:51 PM, Carl Meyer wrote: On 11/29/2017 03:26 PM, Eric V. Smith wrote: I've posted a new version of PEP 557, it should soon be available at https://www.python.org/dev/peps/pep-0557/. The only significant changes since the last version are: - changing the "compare" parameter to b

Re: [Python-Dev] Third and hopefully final post: PEP 557, Data Classes

2017-11-29 Thread Carl Meyer
On 11/29/2017 03:26 PM, Eric V. Smith wrote: > I've posted a new version of PEP 557, it should soon be available at > https://www.python.org/dev/peps/pep-0557/. > > The only significant changes since the last version are: > > - changing the "compare" parameter to be "order", since that more > acc

Re: [Python-Dev] Third and hopefully final post: PEP 557, Data Classes

2017-11-29 Thread Guido van Rossum
I plan to accept this on Monday if no new objections are raised. On Nov 29, 2017 3:28 PM, "Eric V. Smith" wrote: > I've posted a new version of PEP 557, it should soon be available at > https://www.python.org/dev/peps/pep-0557/. > > The only significant changes since the last version are: > > -

[Python-Dev] Third and hopefully final post: PEP 557, Data Classes

2017-11-29 Thread Eric V. Smith
I've posted a new version of PEP 557, it should soon be available at https://www.python.org/dev/peps/pep-0557/. The only significant changes since the last version are: - changing the "compare" parameter to be "order", since that more accurately reflects what it does. - Having the combination