Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #50483 > unrolled thread
| Started by | Christian Heimes <christian@python.org> |
|---|---|
| First post | 2013-07-12 03:21 +0200 |
| Last post | 2013-07-12 03:21 +0200 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Casting classes WAS: Documenting builtin methods Christian Heimes <christian@python.org> - 2013-07-12 03:21 +0200
| From | Christian Heimes <christian@python.org> |
|---|---|
| Date | 2013-07-12 03:21 +0200 |
| Subject | Re: Casting classes WAS: Documenting builtin methods |
| Message-ID | <mailman.4606.1373592088.3114.python-list@python.org> |
Am 12.07.2013 02:23, schrieb Mark Janssen: > A user was wondering why they can't change a docstring in a module's class. For CPython builtin types (classes) and function have read-only doc strings for multiple reasons. Internally the doc strings are stored as constant C string literals. The __doc__ attribute is implemented as descriptor that turns the const char *tp_doc member into a Python string. const char* are ... constant. :) All types and builtins are shared across all subinterpreters of Python. The types and their doc strings are identical. Most people are not aware of the subinterpreter feature. Subinterpreters run in different threads of the same process but are isolated from each other. Mutable type and builtin doc strings would break the isolation. You could share information between subinterpreters by e.g. setting the doc string of the int type. We don't want that. Heap types (classes defined with Python code) are not shared. The same goes to modules, even the sys module. Christian
Back to top | Article view | comp.lang.python
csiph-web