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

2016-06-22 Thread INADA Naoki
Hi, Mark. Thank you for reply. On Thu, Jun 23, 2016 at 10:30 AM, Mark Shannon wrote: > Hi all, > > I think we need some more data before going any further reimplementing > dicts. > > What I would like to know is, across a set of Python programs (ideally a > representative set), what the proporti

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

2016-06-22 Thread INADA Naoki
> Memory usage > > > on amd64 arch. > > key-sharing dict: > > * 96 bytes for ~3 items > * 128 bytes for 4~5 items. Note: There are another shared key. * 128 bytes for ~3 items * 224 bytes for 4~5 items So, let S = how many instances shares the key, * 90 + (96 / S) bytes for

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

2016-06-22 Thread Mark Shannon
Hi all, I think we need some more data before going any further reimplementing dicts. What I would like to know is, across a set of Python programs (ideally a representative set), what the proportion of dicts in memory at any one time are: a) instance dicts b) other namespace dicts (classe

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

2016-06-22 Thread INADA Naoki
As my last email, compact ordered dict can't preserve insertion order of key sharing dict (PEP 412). I'm thinking about deprecating key shared dict for now. Instead, my new idea is introducing more compact dict specialized for namespace. If BDFL (or BDFL delegate) likes this idea, I'll take anot

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

2016-06-22 Thread Eric Fahlgren
On Wed 2016-06-22 Eric Snow [mailto:ericsnowcurren...@gmail.com] wrote: > The problem I have with this is that it still doesn't give any strong > relationship with the class definition. > Certainly in most cases it will amount to the same thing. However, there is > no way to know if cls.__dict__

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

2016-06-22 Thread André Malo
* Serhiy Storchaka wrote: > 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 unpi

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

2016-06-22 Thread Guido van Rossum
On Wed, Jun 22, 2016 at 7:17 AM, Random832 wrote: > The documentation states: """Objects such as modules and instances have > an updateable __dict__ attribute; however, other objects may have write > restrictions on their __dict__ attributes (for example, classes use a > dictproxy to prevent dire

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

2016-06-22 Thread Random832
On Tue, Jun 21, 2016, at 16:48, Serhiy Storchaka wrote: > 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 loa

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

2016-06-22 Thread Random832
The documentation states: """Objects such as modules and instances have an updateable __dict__ attribute; however, other objects may have write restrictions on their __dict__ attributes (for example, classes use a dictproxy to prevent direct dictionary updates).""" However, it's not clear from tha

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

2016-06-22 Thread INADA Naoki
FYI, Here is calculated size of each dict by len(d). https://docs.google.com/spreadsheets/d/1nN5y6IsiJGdNxD7L7KBXmhdUyXjuRAQR_WbrS8zf6mA/edit?usp=sharing On Tue, Jun 21, 2016 at 12:17 PM, Oleg Broytman wrote: > Hi! > > On Tue, Jun 21, 2016 at 11:14:39AM +0900, INADA Naoki > wrote: >> Here is my