Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #50483

Re: Casting classes WAS: Documenting builtin methods

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/simple; d=python.org; s=200901; t=1373592087; bh=haLUMpcW+C7YctUFSTORECoyCmJWlrRFAp82/nkFcvk=; h=To:From:Subject:Date:Message-ID:References:Mime-Version: Content-Type:Content-Transfer-Encoding:In-Reply-To; b=q9yxj3EKV66GGlqLMA32UU8teg9EUXYzwtJYPeCLAZfMHqpEDxkv6xjeUVbmJ9wvD X221TUv/qLSK0FK0ha3AXU0P8Av6j9KxH/VJAnc99YZlyJ+lhkdu7qEmmPDSCjQuKP d+PQneSVBOTJn70ol4wUsN6LCYA0uCnQVWmESiKo=
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'python.': 0.02; 'cpython': 0.05; 'string.': 0.05; 'attribute': 0.07; 'sys': 0.07; 'string': 0.09; 'builtin': 0.09; 'feature.': 0.09; 'read-only': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.11; 'stored': 0.12; 'builtins': 0.16; 'descriptor': 0.16; 'docstring': 0.16; 'from:name:christian heimes': 0.16; 'heap': 0.16; 'internally': 0.16; 'literals.': 0.16; "module's": 0.16; 'modules,': 0.16; 'mutable': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'shared.': 0.16; 'from:addr:python.org': 0.16; 'header:User-Agent:1': 0.23; 'char': 0.24; 'class.': 0.26; 'defined': 0.27; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'wondering': 0.29; 'that.': 0.31; 'constant': 0.31; 'doc': 0.31; 'run': 0.32; 'implemented': 0.33; 'could': 0.34; "can't": 0.35; 'but': 0.35; 'module.': 0.36; 'christian': 0.38; 'e.g.': 0.38; 'to:addr:python- list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'even': 0.60; 'most': 0.60; 'break': 0.61; 'information': 0.63; 'different': 0.65; 'between': 0.67; 'other.': 0.75; 'const': 0.84; 'isolated': 0.84
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Christian Heimes <christian@python.org>
Subject Re: Casting classes WAS: Documenting builtin methods
Date Fri, 12 Jul 2013 03:21:14 +0200
References <CAMjeLr87BMzTB0Mkksvxc8XQLRQP7UUFv2+UzQ3Z_qB_x-cCdw@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host f048012255.adsl.alicedsl.de
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130510 Thunderbird/17.0.6
In-Reply-To <CAMjeLr87BMzTB0Mkksvxc8XQLRQP7UUFv2+UzQ3Z_qB_x-cCdw@mail.gmail.com>
X-Enigmail-Version 1.4.6
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.4606.1373592088.3114.python-list@python.org> (permalink)
Lines 22
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1373592088 news.xs4all.nl 15900 [2001:888:2000:d::a6]:60820
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:50483

Show key headers only | View raw


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 comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Casting classes WAS: Documenting builtin methods Christian Heimes <christian@python.org> - 2013-07-12 03:21 +0200

csiph-web