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

2016-06-23 Thread INADA Naoki
> IIUC, key-sharing dicts are a best-effort optimization where if I have > a class like: > > class Foo: > def __init__(self, a, b): > self.a = a > self.b = b > > f1 = Foo(1, 2) > f2 = Foo(3, 4) > > then f1.__dict__ and f2.__dict__ can share their key arrays... but if > I do f1.c

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

2016-06-23 Thread Nathaniel Smith
On Tue, Jun 21, 2016 at 8:40 PM, INADA Naoki wrote: > 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:

Re: [Python-Dev] Why are class dictionaries not accessible?

2016-06-23 Thread Guido van Rossum
"Er, among our chief weapons are fear, surprise, ctypes, gc, and fanatical devotion to the Pope!" On Thu, Jun 23, 2016 at 1:03 PM, Devin Jeanpierre wrote: > On Thu, Jun 23, 2016 at 8:19 AM, Guido van Rossum > wrote: >> >> It was a long time when I wrote this, but IIRC the breakage could expres

Re: [Python-Dev] Why are class dictionaries not accessible?

2016-06-23 Thread Devin Jeanpierre
On Thu, Jun 23, 2016 at 8:19 AM, Guido van Rossum wrote: > > It was a long time when I wrote this, but IIRC the breakage could express > itself as a segfault or other C-level crash due to some internal state > invariant of the type object being violated, not just an exception. The > existence of c

Re: [Python-Dev] PEP XXX: Compact ordered dict

2016-06-23 Thread INADA Naoki
On Fri, Jun 24, 2016 at 12:03 AM, Eric Snow wrote: > On Mon, Jun 20, 2016 at 11:02 PM, INADA Naoki wrote: >> On Tue, Jun 21, 2016 at 12:17 PM, Oleg Broytman wrote: >>> (if a PEP is needed at all) >> >> I don't think so. My PEP is not for changing Python Language, >> just describe implementation

Re: [Python-Dev] Why are class dictionaries not accessible?

2016-06-23 Thread Guido van Rossum
On Thu, Jun 23, 2016 at 8:01 AM, Random832 wrote: > On Wed, Jun 22, 2016, at 11:11, Guido van Rossum wrote: > > This is done in order to force all mutations of the class dict to go > > through attribute assignments on the class. The latter takes care of > > updating the class struct, e.g. if you

Re: [Python-Dev] PEP XXX: Compact ordered dict

2016-06-23 Thread Eric Snow
On Mon, Jun 20, 2016 at 11:02 PM, INADA Naoki wrote: > On Tue, Jun 21, 2016 at 12:17 PM, Oleg Broytman wrote: >> (if a PEP is needed at all) > > I don't think so. My PEP is not for changing Python Language, > just describe implementation detail. > > Python 3.5 has new OrderedDict implemented in C

Re: [Python-Dev] Why are class dictionaries not accessible?

2016-06-23 Thread Random832
On Wed, Jun 22, 2016, at 11:11, Guido van Rossum wrote: > This is done in order to force all mutations of the class dict to go > through attribute assignments on the class. The latter takes care of > updating the class struct, e.g. if you were to add an `__add__` method > dynamically it would updat

Re: [Python-Dev] Idea: more compact, interned string key only dict for namespace.

2016-06-23 Thread INADA Naoki
I've checked time and maxrss of sphinx-build. In case of sphinx, ## master $ rm -rf build/ $ /usr/bin/time ~/local/python-master/bin/sphinx-build -b html -d build/doctrees -D latex_paper_size= . build/html -QN 71.76user 0.27system 1:12.06elapsed 99%CPU (0avgtext+0avgdata 176248maxresident)k 8