[Python-Dev] Compact ordered dict is not ordered for split table. (was: PEP XXX: Compact ordered dict

2016-06-21 Thread INADA Naoki
I'm sorry, but I hadn't realized which compact ordered dict is not ordered for split table. For example: >>> class A: ... ... ... >>> a = A() >>> b = A() >>> a.a = 1 >>> a.b = 2 >>> b.b = 3 >>> b.a = 4 >>> a.__dict__.items() dict_items([('a', 1), ('b', 2)]) >>> b.__dict__.items() dict_items([('a

Re: [Python-Dev] PEP 487: Simpler customization of class creation

2016-06-21 Thread Eric Snow
On Mon, Jun 20, 2016 at 12:31 PM, Nikita Nemkin wrote: > Right. Ordered by default is a very serious implementation constraint. > It's only superior in a sense that it completely subsumes/obsoletes > PEP 520. Just to be clear, PEP 520 is more than just OrderedDict-by-default. In fact, the key poi

Re: [Python-Dev] PEP 487: Simpler customization of class creation

2016-06-21 Thread Guido van Rossum
On Tue, Jun 21, 2016 at 10:12 AM, Eric Snow wrote: > On Mon, Jun 20, 2016 at 12:31 PM, Nikita Nemkin wrote: > > Right. Ordered by default is a very serious implementation constraint. > > It's only superior in a sense that it completely subsumes/obsoletes > > PEP 520. > > Just to be clear, PEP 52

Re: [Python-Dev] PEP 487: Simpler customization of class creation

2016-06-21 Thread Raymond Hettinger
> On Jun 21, 2016, at 10:18 AM, Guido van Rossum wrote: > > Judging from Inada's message there seems to be some confusion about how well > the compact dict preserves order (personally I think if it doesn't guarantee > order after deletions it's pretty useless). Inada should follow PyPy's impl

[Python-Dev] When to use EOFError?

2016-06-21 Thread Serhiy Storchaka
There is a design question. If you read file in some format or with some protocol, and the data is ended unexpectedly, when to use general EOFError exception and when to use format/protocol specific exception? For example when load truncated pickle data, an unpickler can raise EOFError, Unpick

Re: [Python-Dev] PEP 487: Simpler customization of class creation

2016-06-21 Thread Nick Coghlan
On 21 June 2016 at 10:18, Guido van Rossum wrote: > On Tue, Jun 21, 2016 at 10:12 AM, Eric Snow > wrote: >> >> On Mon, Jun 20, 2016 at 12:31 PM, Nikita Nemkin wrote: >> > Right. Ordered by default is a very serious implementation constraint. >> > It's only superior in a sense that it completely

Re: [Python-Dev] frame evaluation API PEP

2016-06-21 Thread Nick Coghlan
On 20 June 2016 at 13:32, Dino Viehland via Python-Dev wrote: > It doesn’t help with the issue of potentially multiple consumers of that field > that has been brought up before but I’m not sure how concerned we should be > about that scenario anyway. Brett's comparison with sys.settrace seems rel

Re: [Python-Dev] When to use EOFError?

2016-06-21 Thread Victor Stinner
When loading truncated data with pickle, I expect a pickle error, not a generic ValueError nor EOFError. Victor ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/ma

Re: [Python-Dev] Review of PEP 520: Ordered Class Definition Namespace

2016-06-21 Thread Nick Coghlan
On 20 June 2016 at 19:11, Eric Snow wrote: > FWIW, regarding repercussions, I do not expect any other potential > future feature will subsume the functionality of PEP 520. The closest > thing would be if cls.__dict__ became ordered. However, that would > intersect with __definition_order__ only

Re: [Python-Dev] PEP 487: Simpler customization of class creation

2016-06-21 Thread INADA Naoki
On Wed, Jun 22, 2016 at 2:50 AM, Raymond Hettinger wrote: > >> On Jun 21, 2016, at 10:18 AM, Guido van Rossum wrote: >> >> Judging from Inada's message there seems to be some confusion about how well >> the compact dict preserves order (personally I think if it doesn't guarantee >> order after

Re: [Python-Dev] Review of PEP 520: Ordered Class Definition Namespace

2016-06-21 Thread Eric Snow
On Tue, Jun 21, 2016 at 3:21 PM, Nick Coghlan wrote: > It occurs to me that a settable __definition_order__ provides a > benefit that an ordered tp_dict doesn't: to get the "right" definition > order in something like Cython or dynamic type creation, you don't > need to carefully craft the order i

Re: [Python-Dev] PEP 487: Simpler customization of class creation

2016-06-21 Thread Eric Snow
On Tue, Jun 21, 2016 at 11:18 AM, Guido van Rossum wrote: > If we had had these semantics in the language from the start, there would have > been plenty uses of this order, and I suspect nobody would have considered > asking for __definition_order__. True. The key thing that __definition_order__

Re: [Python-Dev] PEP 487: Simpler customization of class creation

2016-06-21 Thread Eric Snow
On Tue, Jun 21, 2016 at 3:01 PM, Nick Coghlan wrote: > RIght, if *tp_dict itself* on type objects is guaranteed to be > order-preserviing, then we don't need to do anything except perhaps > provide a helper method or descriptor on type that automatically > filters out the dunder-attributes, and sp

Re: [Python-Dev] Compact ordered dict is not ordered for split table. (was: PEP XXX: Compact ordered dict

2016-06-21 Thread INADA Naoki
There are three options I can think. 1) Revert key-shared dict (PEP412). pros: Removing key-shared dict makes dict implementation simple. cons: In some applications, PEP 412 is far more compact than compact ordered dict. (Note: Using __slots__ may help such situation). 2) Don't make "keeping

Re: [Python-Dev] PEP 487: Simpler customization of class creation

2016-06-21 Thread Greg Ewing
Nick Coghlan wrote: Something that isn't currently defined in PEP 520 ... is where descriptors implicitly defined via __slots__ will appear relative to other attributes. In the place where the __slots__ attribute appears? -- Greg ___ Python-Dev maili