Re: [Python-Dev] PEP 557 Data Classes 5th posting

2017-12-03 Thread Eric V. Smith
I've made a minor change: the return type of fields() is now a tuple, it 
was a list.


Eric.

On 12/2/2017 9:02 AM, Eric V. Smith wrote:
I've pushed another version of PEP 557. The only difference is changing 
the default value of "order" to False instead of True. This matches 
regular classes: instances can be tested for equality, but are unordered.


Discussion at https://github.com/ericvsmith/dataclasses/issues/104

It's already available at https://www.python.org/dev/peps/pep-0557/

I've updated the implementation on PyPI to reflect this change: 
https://pypi.python.org/pypi/dataclasses/0.3


Eric.
___
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/eric%2Ba-python-dev%40trueblade.com 



___
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] PEP 557 Data Classes 5th posting

2017-12-03 Thread Guido van Rossum
Not sure I like that better. It's an open-ended sequence of homogeneous
types. What's the advantage of a tuple? I don't want to blindly follow
existing APIs.

On Sun, Dec 3, 2017 at 6:55 AM, Eric V. Smith  wrote:

> I've made a minor change: the return type of fields() is now a tuple, it
> was a list.
>
> Eric.
>
> On 12/2/2017 9:02 AM, Eric V. Smith wrote:
>
>> I've pushed another version of PEP 557. The only difference is changing
>> the default value of "order" to False instead of True. This matches regular
>> classes: instances can be tested for equality, but are unordered.
>>
>> Discussion at https://github.com/ericvsmith/dataclasses/issues/104
>>
>> It's already available at https://www.python.org/dev/peps/pep-0557/
>>
>> I've updated the implementation on PyPI to reflect this change:
>> https://pypi.python.org/pypi/dataclasses/0.3
>>
>> Eric.
>> ___
>> Python-Dev mailing list
>> [email protected]
>> https://mail.python.org/mailman/listinfo/python-dev
>> Unsubscribe: https://mail.python.org/mailman/options/python-dev/eric%2Ba-
>> python-dev%40trueblade.com
>>
>
> ___
> Python-Dev mailing list
> [email protected]
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: https://mail.python.org/mailman/options/python-dev/guido%
> 40python.org
>



-- 
--Guido van Rossum (python.org/~guido)
___
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] PEP 557 Data Classes 5th posting

2017-12-03 Thread Eric V. Smith

On 12/3/2017 11:56 AM, Guido van Rossum wrote:
Not sure I like that better. It's an open-ended sequence of homogeneous 
types. What's the advantage of a tuple? I don't want to blindly follow 
existing APIs.


So people don't modify it, but consenting adults would say "don't do 
that". I currently return a new tuple in each call to fields(), but in 
the future I might return the same one every time (per class).


I really don't care so much. The only reason I made any change was 
because the implementation was returning an OrderedDict, so I was 
changing the tests anyway. I'm happy to change it back to a list, based 
on the convention of homogeneous types being in a list.


Eric.



On Sun, Dec 3, 2017 at 6:55 AM, Eric V. Smith > wrote:


I've made a minor change: the return type of fields() is now a
tuple, it was a list.

Eric.

On 12/2/2017 9:02 AM, Eric V. Smith wrote:

I've pushed another version of PEP 557. The only difference is
changing the default value of "order" to False instead of True.
This matches regular classes: instances can be tested for
equality, but are unordered.

Discussion at
https://github.com/ericvsmith/dataclasses/issues/104


It's already available at
https://www.python.org/dev/peps/pep-0557/


I've updated the implementation on PyPI to reflect this change:
https://pypi.python.org/pypi/dataclasses/0.3


Eric.
___
Python-Dev mailing list
[email protected] 
https://mail.python.org/mailman/listinfo/python-dev

Unsubscribe:

https://mail.python.org/mailman/options/python-dev/eric%2Ba-python-dev%40trueblade.com





___
Python-Dev mailing list
[email protected] 
https://mail.python.org/mailman/listinfo/python-dev

Unsubscribe:
https://mail.python.org/mailman/options/python-dev/guido%40python.org 





--
--Guido van Rossum (python.org/~guido )


___
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] PEP 557 Data Classes 5th posting

2017-12-03 Thread Guido van Rossum
On second thought I don't care that much.

On Dec 3, 2017 9:07 AM, "Eric V. Smith"  wrote:

> On 12/3/2017 11:56 AM, Guido van Rossum wrote:
>
>> Not sure I like that better. It's an open-ended sequence of homogeneous
>> types. What's the advantage of a tuple? I don't want to blindly follow
>> existing APIs.
>>
>
> So people don't modify it, but consenting adults would say "don't do
> that". I currently return a new tuple in each call to fields(), but in the
> future I might return the same one every time (per class).
>
> I really don't care so much. The only reason I made any change was because
> the implementation was returning an OrderedDict, so I was changing the
> tests anyway. I'm happy to change it back to a list, based on the
> convention of homogeneous types being in a list.
>
> Eric.
>
>
>> On Sun, Dec 3, 2017 at 6:55 AM, Eric V. Smith > > wrote:
>>
>> I've made a minor change: the return type of fields() is now a
>> tuple, it was a list.
>>
>> Eric.
>>
>> On 12/2/2017 9:02 AM, Eric V. Smith wrote:
>>
>> I've pushed another version of PEP 557. The only difference is
>> changing the default value of "order" to False instead of True.
>> This matches regular classes: instances can be tested for
>> equality, but are unordered.
>>
>> Discussion at
>> https://github.com/ericvsmith/dataclasses/issues/104
>> 
>>
>> It's already available at
>> https://www.python.org/dev/peps/pep-0557/
>> 
>>
>> I've updated the implementation on PyPI to reflect this change:
>> https://pypi.python.org/pypi/dataclasses/0.3
>> 
>>
>> Eric.
>> ___
>> Python-Dev mailing list
>> [email protected] 
>> https://mail.python.org/mailman/listinfo/python-dev
>> 
>> Unsubscribe:
>> https://mail.python.org/mailman/options/python-dev/eric%2Ba-
>> python-dev%40trueblade.com
>> > 2Ba-python-dev%40trueblade.com>
>>
>>
>>
>> ___
>> Python-Dev mailing list
>> [email protected] 
>> https://mail.python.org/mailman/listinfo/python-dev
>> 
>> Unsubscribe:
>> https://mail.python.org/mailman/options/python-dev/guido%40python.org
>> 
>>
>>
>>
>>
>> --
>> --Guido van Rossum (python.org/~guido )
>>
>
>
___
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] PEP 557 Data Classes 5th posting

2017-12-03 Thread Antoine Pitrou
On Sat, 2 Dec 2017 09:02:37 -0500
"Eric V. Smith"  wrote:
> I've pushed another version of PEP 557. The only difference is changing 
> the default value of "order" to False instead of True. This matches 
> regular classes: instances can be tested for equality, but are unordered.
> 
> Discussion at https://github.com/ericvsmith/dataclasses/issues/104
> 
> It's already available at https://www.python.org/dev/peps/pep-0557/

Thanks.  I have to ask: why don't "asdict" and "astuple" respect PEP 8
naming?

Regards

Antoine.


___
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] PEP 557 Data Classes 5th posting

2017-12-03 Thread Eric V. Smith
Me, either. So I'm going to leave it as a tuple. Unless I find something 
while reviewing it tonight, I'm done.


Eric.

On 12/3/2017 3:02 PM, Guido van Rossum wrote:

On second thought I don't care that much.

On Dec 3, 2017 9:07 AM, "Eric V. Smith" > wrote:


On 12/3/2017 11:56 AM, Guido van Rossum wrote:

Not sure I like that better. It's an open-ended sequence of
homogeneous types. What's the advantage of a tuple? I don't want
to blindly follow existing APIs.


So people don't modify it, but consenting adults would say "don't do
that". I currently return a new tuple in each call to fields(), but
in the future I might return the same one every time (per class).

I really don't care so much. The only reason I made any change was
because the implementation was returning an OrderedDict, so I was
changing the tests anyway. I'm happy to change it back to a list,
based on the convention of homogeneous types being in a list.

Eric.


On Sun, Dec 3, 2017 at 6:55 AM, Eric V. Smith
mailto:[email protected]>
>> wrote:

     I've made a minor change: the return type of fields() is now a
     tuple, it was a list.

     Eric.

     On 12/2/2017 9:02 AM, Eric V. Smith wrote:

         I've pushed another version of PEP 557. The only
difference is
         changing the default value of "order" to False instead
of True.
         This matches regular classes: instances can be tested for
         equality, but are unordered.

         Discussion at
https://github.com/ericvsmith/dataclasses/issues/104

         >

         It's already available at
https://www.python.org/dev/peps/pep-0557/

         >

         I've updated the implementation on PyPI to reflect this
change:
https://pypi.python.org/pypi/dataclasses/0.3

         >

         Eric.
         ___
         Python-Dev mailing list
[email protected] 
>
https://mail.python.org/mailman/listinfo/python-dev

         >
         Unsubscribe:

https://mail.python.org/mailman/options/python-dev/eric%2Ba-python-dev%40trueblade.com



>



     ___
     Python-Dev mailing list
[email protected] 
>
https://mail.python.org/mailman/listinfo/python-dev

     >
     Unsubscribe:
https://mail.python.org/mailman/options/python-dev/guido%40python.org

>




-- 
--Guido van Rossum (python.org/~guido

 )




___
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] PEP 557 Data Classes 5th posting

2017-12-03 Thread Eric V. Smith

On 12/3/2017 3:33 PM, Antoine Pitrou wrote:

On Sat, 2 Dec 2017 09:02:37 -0500
"Eric V. Smith"  wrote:

I've pushed another version of PEP 557. The only difference is changing
the default value of "order" to False instead of True. This matches
regular classes: instances can be tested for equality, but are unordered.

Discussion at https://github.com/ericvsmith/dataclasses/issues/104

It's already available at https://www.python.org/dev/peps/pep-0557/


Thanks.  I have to ask: why don't "asdict" and "astuple" respect PEP 8
naming?


I guess it depends if you think the underscore is needed to improve 
readability. "Function names should be lowercase, with words separated 
by underscores as necessary to improve readability."


I don't feel strongly enough about it to change it, but part of that is 
because I'm burned out on the PEP, so I might not be a good one to judge 
at this point. I guess if I clear my head and I were doing it from 
scratch again I'd make them as_dict and as_tuple, so maybe I should 
brush aside inertia and make the change.


Eric.
___
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] PEP 557 Data Classes 5th posting

2017-12-03 Thread Guido van Rossum
On Sun, Dec 3, 2017 at 1:28 PM, Eric V. Smith  wrote:

> On 12/3/2017 3:33 PM, Antoine Pitrou wrote:
>
>> On Sat, 2 Dec 2017 09:02:37 -0500
>> "Eric V. Smith"  wrote:
>>
>>> I've pushed another version of PEP 557. The only difference is changing
>>> the default value of "order" to False instead of True. This matches
>>> regular classes: instances can be tested for equality, but are unordered.
>>>
>>> Discussion at https://github.com/ericvsmith/dataclasses/issues/104
>>>
>>> It's already available at https://www.python.org/dev/peps/pep-0557/
>>>
>>
>> Thanks.  I have to ask: why don't "asdict" and "astuple" respect PEP 8
>> naming?
>>
>
> I guess it depends if you think the underscore is needed to improve
> readability. "Function names should be lowercase, with words separated by
> underscores as necessary to improve readability."
>
> I don't feel strongly enough about it to change it, but part of that is
> because I'm burned out on the PEP, so I might not be a good one to judge at
> this point. I guess if I clear my head and I were doing it from scratch
> again I'd make them as_dict and as_tuple, so maybe I should brush aside
> inertia and make the change.
>

The Python stdlib is incredibly inconsistent where it comes to inserting
underscores. I think in this case it matches `namedtuple._asdict()` and
that's good enough for me.

-- 
--Guido van Rossum (python.org/~guido)
___
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] PEP 557 Data Classes 5th posting

2017-12-03 Thread Eric V. Smith

On 12/3/2017 8:31 PM, Guido van Rossum wrote:
On Sun, Dec 3, 2017 at 1:28 PM, Eric V. Smith > wrote:


On 12/3/2017 3:33 PM, Antoine Pitrou wrote:





Thanks.  I have to ask: why don't "asdict" and "astuple" respect
PEP 8
naming?


I guess it depends if you think the underscore is needed to improve
readability. "Function names should be lowercase, with words
separated by underscores as necessary to improve readability."

I don't feel strongly enough about it to change it, but part of that
is because I'm burned out on the PEP, so I might not be a good one
to judge at this point. I guess if I clear my head and I were doing
it from scratch again I'd make them as_dict and as_tuple, so maybe I
should brush aside inertia and make the change.


The Python stdlib is incredibly inconsistent where it comes to inserting 
underscores. I think in this case it matches `namedtuple._asdict()` and 
that's good enough for me.


It also matches `attrs.asdict()`, which is what originally inspired it.

Eric.

___
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] PEP 557 Data Classes 5th posting

2017-12-03 Thread Eric V. Smith

On 12/3/2017 9:07 PM, Eric V. Smith wrote:


It also matches `attrs.asdict()`, which is what originally inspired it.


Make that `attr.asdict()`. So easy to get that wrong.

Eric.

___
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com