Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #19653
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder2.hal-mli.net!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <ethan@stoneleaf.us> |
| 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; 'distinct': 0.05; 'char': 0.07; 'components.': 0.07; 'imply': 0.07; 'python': 0.08; 'from:addr:ethan': 0.09; 'from:addr:stoneleaf.us': 0.09; 'from:name:ethan furman': 0.09; 'message-id:@stoneleaf.us': 0.09; 'received:gator410.hostgator.com': 0.09; 'tuple': 0.09; '~ethan~': 0.09; 'am,': 0.12; 'result,': 0.15; '37,': 0.16; '39,': 0.16; '43,': 0.16; 'classes)': 0.16; 'container,': 0.16; 'container.': 0.16; 'received:72.11': 0.16; 'received:72.11.125': 0.16; 'received:72.11.125.166': 0.16; 'strs': 0.16; 'subject:syntax': 0.16; 'subject:question': 0.16; 'wrote:': 0.16; '>>>': 0.18; 'say,': 0.19; 'jan': 0.19; "doesn't": 0.22; 'header:In-Reply- To:1': 0.22; 'pieces': 0.23; 'defined': 0.24; 'string': 0.24; 'fact': 0.27; 'random': 0.28; 'second': 0.29; '(and': 0.29; 'characters,': 0.30; 'tuples': 0.30; 'certainly': 0.32; 'represents': 0.32; 'objects': 0.32; 'tue,': 0.32; 'list': 0.32; 'it.': 0.33; 'header:User-Agent:1': 0.33; 'to:addr:python-list': 0.33; 'object': 0.33; 'there': 0.33; 'this.': 0.33; 'position.': 0.34; 'location,': 0.34; 'record': 0.35; 'lists,': 0.35; 'however,': 0.35; 'example,': 0.36; 'list,': 0.37; 'could': 0.37; 'component': 0.38; 'steven': 0.38; 'allows': 0.38; 'some': 0.38; 'created': 0.38; 'think': 0.38; 'sometimes': 0.38; 'should': 0.38; 'word,': 0.38; 'goes': 0.39; 'absolute': 0.39; 'define': 0.39; 'subject:: ': 0.39; 'change': 0.40; 'might': 0.40; 'to:addr:python.org': 0.40; 'most': 0.60; 'more': 0.61; '31,': 0.64; 'view': 0.64; 'received:websitewelcome.com': 0.64; 'charles': 0.67; 'received:184': 0.67; 'special': 0.67; 'records': 0.74; '"there': 0.84; '-0500,': 0.84; '2012,': 0.84; 'compare:': 0.84; 'it"': 0.84; 'received:64.5': 0.84; 'sets,': 0.84 |
| Date | Tue, 31 Jan 2012 08:56:57 -0800 |
| From | Ethan Furman <ethan@stoneleaf.us> |
| User-Agent | Thunderbird 1.5.0.10 (Windows/20070221) |
| MIME-Version | 1.0 |
| To | Python <python-list@python.org> |
| Subject | Re: except clause syntax question |
| References | <mailman.5218.1327946109.27778.python-list@python.org> <4f272f1f$0$29989$c3e8da3$5496439d@news.astraweb.com> <mailman.5243.1328018257.27778.python-list@python.org> <4f27ffd8$0$29989$c3e8da3$5496439d@news.astraweb.com> <440642C3-B9CD-4BC7-AF57-4013238C2C5C@declareSub.com> |
| In-Reply-To | <440642C3-B9CD-4BC7-AF57-4013238C2C5C@declareSub.com> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-AntiAbuse | This header was added to track abuse, please include it with any abuse report |
| X-AntiAbuse | Primary Hostname - gator410.hostgator.com |
| X-AntiAbuse | Original Domain - python.org |
| X-AntiAbuse | Originator/Caller UID/GID - [47 12] / [47 12] |
| X-AntiAbuse | Sender Address Domain - stoneleaf.us |
| X-BWhitelist | no |
| X-Source | |
| X-Source-Args | |
| X-Source-Dir | |
| X-Source-Sender | mail.admailinc.com ([192.168.10.136]) [72.11.125.166]:3381 |
| X-Source-Auth | ethan+stoneleaf.us |
| X-Email-Count | 1 |
| X-Source-Cap | dG9idWs7dG9idWs7Z2F0b3I0MTAuaG9zdGdhdG9yLmNvbQ== |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| 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.5256.1328032352.27778.python-list@python.org> (permalink) |
| Lines | 53 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1328032352 news.xs4all.nl 6978 [2001:888:2000:d::a6]:32814 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:19653 |
Show key headers only | View raw
Charles Yeomans wrote:
> On Jan 31, 2012, at 9:51 AM, Steven D'Aprano wrote:
>> On Tue, 31 Jan 2012 08:57:31 -0500, Charles Yeomans wrote:
>>
>>> I don't think of a tuple as a container, and I don't think it a
>>> misunderstanding on my part to think this.
>>
>> Well, it is a misunderstanding, because tuples ARE containers. You
>> might as well say "I don't think of boxes as containers". What
>> exactly are they if not containers?
>
> Tuple is a heterogenous datatype that allows one to define objects
> ad hoc.
And any object can be seen as a container for its component pieces --
some are just more general than others.
Compare:
location = (13, 4, 9) # line, word, char
time = (10, 15, 41) # hour, minute, second
result = ('this', 'that', 'huh') # result a, result b, result c
with:
record1 = Record('Ethan', 41, Male)
record2 = Record('Charles', 37, Male)
record3 = Record('Steven', 43, Male)
record4 = Record('Jennifer', 39, Female)
In this example, Records have a set layout and so it is more common to
think of a Record as a thing; location, time, and result, however, are
all random tuples created on the fly with no absolute restrictions on
what goes in which position.
lists, dicts, sets, and tuples are general purpose containers; strs (and
most user defined classes) are special purpose containers.
> That is to say, a tuple represents a single thing distinct from its
> components.
You could say that about a list as well. Doesn't change the fact that a
list is a container.
> One can certainly view a tuple as a list, just as one can view a string
> as a list of characters, and sometimes that's useful; the Python dictum
> "there should only be one way to do it" doesn't imply that there is only
> one way to think of it.
The 'dictum' is "there should only be one *obvious* way to do it"
(emphasis added).
~Ethan~
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
except clause syntax question Charles Yeomans <charles@declareSub.com> - 2012-01-30 12:41 -0500
Re: except clause syntax question Mel Wilson <mwilson@the-wire.com> - 2012-01-30 14:15 -0500
Re: except clause syntax question Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-01-31 00:00 +0000
Re: except clause syntax question Devin Jeanpierre <jeanpierreda@gmail.com> - 2012-01-30 19:25 -0500
Re: except clause syntax question Charles Yeomans <charles@declareSub.com> - 2012-01-31 08:57 -0500
Re: except clause syntax question Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-01-31 14:51 +0000
Re: except clause syntax question Charles Yeomans <charles@declareSub.com> - 2012-01-31 11:23 -0500
Re: except clause syntax question Devin Jeanpierre <jeanpierreda@gmail.com> - 2012-01-31 11:38 -0500
Re: except clause syntax question Charles Yeomans <charles@declaresub.com> - 2012-01-31 12:29 -0500
Re: except clause syntax question Ethan Furman <ethan@stoneleaf.us> - 2012-01-31 08:56 -0800
Re: except clause syntax question Terry Reedy <tjreedy@udel.edu> - 2012-01-31 19:12 -0500
Re: except clause syntax question Charles Yeomans <charles@declareSub.com> - 2012-01-31 19:27 -0500
Re: except clause syntax question Mel Wilson <mwilson@the-wire.com> - 2012-01-31 08:24 -0500
Re: except clause syntax question Charles Yeomans <charles@declareSub.com> - 2012-01-31 13:04 -0500
Re: except clause syntax question Duncan Booth <duncan.booth@invalid.invalid> - 2012-01-31 22:03 +0000
Re: except clause syntax question Chris Angelico <rosuav@gmail.com> - 2012-02-01 11:53 +1100
Re: except clause syntax question Mel Wilson <mwilson@the-wire.com> - 2012-01-31 23:39 -0500
Re: except clause syntax question Ian Kelly <ian.g.kelly@gmail.com> - 2012-01-31 18:09 -0700
Re: except clause syntax question Ian Kelly <ian.g.kelly@gmail.com> - 2012-01-31 18:12 -0700
Re: except clause syntax question Chris Angelico <rosuav@gmail.com> - 2012-02-01 13:46 +1100
csiph-web