[issue34386] Expose a dictionary of interned strings in sys module

2018-08-13 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I concur with Ronald. Using a dict instance is an implementation detail. 
CPython could use a dict, a set, a hashtable implementation from 
Modules/hashtable.c, or the HAMT implementation from Python/hamt.c. Other 
Python implementations can have other options.

--
nosy: +serhiy.storchaka
resolution:  -> rejected
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34386] Expose a dictionary of interned strings in sys module

2018-08-13 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

IMHO we shouldn't expose the intern dictionary without there being a clear, and 
good enough, use case for doing so.  

Exposing the dictionary decreases implementation flexibility, and increases 
requirements on other implementations.  One example of the former: at least in 
theory the interning dictionary could be a set, but we couldn't make that 
change if the dictionary were exposed in the API.

With current information I'm -1 on exposing the dictionary, and -0 on doing 
that for debug builds only.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34386] Expose a dictionary of interned strings in sys module

2018-08-12 Thread Artem Golubin


Artem Golubin  added the comment:

Thank you, I agree. I can't come up with practical use cases other than my 
curiosity. 

Is it possible to somehow expose the dictionary in the debug build of Python? 
Currently, there is no way to access it from the interpreter even with ctypes.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34386] Expose a dictionary of interned strings in sys module

2018-08-12 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

Another reason for not wanting write access to the sys.intern dictionary is 
that this dictionary does not own references to its keys and values.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34386] Expose a dictionary of interned strings in sys module

2018-08-12 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I wouldn't want a user to be able to mutate the dictionary directly (otherwise, 
non-strings could be added).

--
nosy: +rhettinger

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34386] Expose a dictionary of interned strings in sys module

2018-08-12 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

Could you explain why this would be useful?

--
nosy: +ronaldoussoren

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34386] Expose a dictionary of interned strings in sys module

2018-08-12 Thread Artem Golubin


New submission from Artem Golubin :

Python provides an ability to intern strings (sys.intern). It would be useful 
to expose a read-only dictionary of interned strings to the Python users so we 
can see what kind of strings are interned. 

It takes minimal changes since internally it's just a dictionary. Is this worth 
adding to the sys module?

--
components: Interpreter Core
messages: 323437
nosy: rushter
priority: normal
severity: normal
status: open
title: Expose a dictionary of interned strings in sys module
type: enhancement
versions: Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com