Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #54774
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed1.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 |
| X-Spam-Status | OK 0.002 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'mrab': 0.05; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'trailing': 0.09; 'underscore': 0.09; 'jan': 0.12; 'wrote': 0.14; "wouldn't": 0.14; '"private"': 0.16; '9:15': 0.16; 'attribute.': 0.16; 'clashes': 0.16; 'namedtuple': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'subject:Convert': 0.16; 'exception': 0.16; 'wrote:': 0.18; 'wed,': 0.18; '>>>': 0.22; 'header:User-Agent:1': 0.23; 'certainly': 0.24; 'documented': 0.24; 'define': 0.26; 'header:X -Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'tim': 0.29; 'chase': 0.31; "d'aprano": 0.31; 'sep': 0.31; 'steven': 0.31; 'tuples': 0.31; 'url:python': 0.33; 'sense': 0.34; 'but': 0.35; 'url:org': 0.36; 'starting': 0.37; 'sometimes': 0.38; 'url:library': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'embedded': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'users': 0.40; 'received:173': 0.61; 'such': 0.63; 'field': 0.63; 'more': 0.64; 'private.': 0.84; 'received:fios.verizon.net': 0.84; '2013': 0.98 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Terry Reedy <tjreedy@udel.edu> |
| Subject | Re: Convert namedtuple to dictionary |
| Date | Wed, 25 Sep 2013 21:45:31 -0400 |
| References | <635a3b46-3150-409f-8a9d-002af18fb734@googlegroups.com> <mailman.325.1380152379.18130.python-list@python.org> <52438924$0$30000$c3e8da3$5496439d@news.astraweb.com> <52438AC6.9060206@mrabarnett.plus.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Gmane-NNTP-Posting-Host | pool-173-75-251-66.phlapa.fios.verizon.net |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.0 |
| In-Reply-To | <52438AC6.9060206@mrabarnett.plus.com> |
| 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 | <https://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 | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.333.1380159943.18130.python-list@python.org> (permalink) |
| Lines | 31 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1380159943 news.xs4all.nl 15892 [2001:888:2000:d::a6]:47341 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:54774 |
Show key headers only | View raw
On 9/25/2013 9:15 PM, MRAB wrote: > On 26/09/2013 02:08, Steven D'Aprano wrote: >> On Wed, 25 Sep 2013 18:41:25 -0500, Tim Chase wrote about namedtuple: >> >>> While it uses the "private" member-variable "_fields", you can do >> >> It's not actually private! >> >> namedtuple is documented as an exception to the rule that methods >> starting with a single leading underscore are private. Named tuples >> define three public methods and one data attribute. In order to avoid >> clashing with field names, they start with a single underscore, but they >> are documented as public: >> >> _make >> _asdict >> _replace >> _fields >> >> >> http://docs.python.org/2/library/collections.html#namedtuple-factory-function-for-tuples-with-named-fields >> >> > Wouldn't it have made more sense to have a trailing underscore instead? Users might use such to avoid clashes with keywords and builtins: 'print_', 'id_', 'as_', and will certainly sometimes use embedded _. -- Terry Jan Reedy
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Convert namedtuple to dictionary tripsvt@gmail.com - 2013-09-25 15:45 -0700
Re: Convert namedtuple to dictionary Tim Chase <python.list@tim.thechases.com> - 2013-09-25 18:41 -0500
Re: Convert namedtuple to dictionary Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-09-26 01:08 +0000
Re: Convert namedtuple to dictionary MRAB <python@mrabarnett.plus.com> - 2013-09-26 02:15 +0100
Re: Convert namedtuple to dictionary Terry Reedy <tjreedy@udel.edu> - 2013-09-25 21:45 -0400
Re: Convert namedtuple to dictionary Tim Chase <python.list@tim.thechases.com> - 2013-09-26 06:51 -0500
Re: Convert namedtuple to dictionary MRAB <python@mrabarnett.plus.com> - 2013-09-26 00:52 +0100
Re: Convert namedtuple to dictionary Ned Batchelder <ned@nedbatchelder.com> - 2013-09-25 20:15 -0400
Re: Convert namedtuple to dictionary Steven D'Aprano <steve@pearwood.info> - 2013-09-26 03:48 +0000
Re: Convert namedtuple to dictionary Peter Otten <__peter__@web.de> - 2013-09-26 08:47 +0200
csiph-web