Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #33512
| References | (1 earlier) <55443eb7-847c-4f4c-8d04-1e6b507aac00@googlegroups.com> <50a8acdc$0$29978$c3e8da3$5496439d@news.astraweb.com> <roy-EFE1F1.08532518112012@news.panix.com> <50a911ec$0$29978$c3e8da3$5496439d@news.astraweb.com> <20121118121614.24d2416d@dilbert> |
|---|---|
| Date | 2012-11-19 07:02 +1100 |
| Subject | Re: Python Interview Questions |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3799.1353268978.27098.python-list@python.org> (permalink) |
On Mon, Nov 19, 2012 at 4:16 AM, D'Arcy J.M. Cain <darcy@druid.net> wrote:
> On 18 Nov 2012 16:50:52 GMT
> Steven D'Aprano <steve+comp.lang.python@pearwood.info> wrote:
>> On Sun, 18 Nov 2012 08:53:25 -0500, Roy Smith wrote:
>>> > Use a list when you need an ordered collection which is mutable
>> > (i.e. can be altered after being created). Use a tuple when you
>> > need an immutable list (such as for a dictionary key).
>>
>> I keep hearing about this last one, but I wonder... who *actually*
>> does this? I've created many, many lists over the years -- lists of
>> names, lists of phone numbers, lists of directory search paths, all
>> sorts of things. I've never needed to use one as a dictionary key.
>
> Well, as long as *you* never needed it then...
>
> CellBlock = 9 # There's a riot going on...
> Cell = 17
> Bunk = "top"
>
> Prisoner = {(CellBlock, Cell, Bunk): "Bernie Madoff"}
That's a structure, not a list. Every key will consist of precisely
three values: two integers and one keyword string. Already covered by
a previous example.
ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: Python Interview Questions chinjannisha@gmail.com - 2012-11-17 10:01 -0800
Re: Python Interview Questions Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-11-18 01:54 -0500
Re: Python Interview Questions Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-11-18 09:39 +0000
Re: Python Interview Questions Roy Smith <roy@panix.com> - 2012-11-18 08:53 -0500
Re: Python Interview Questions Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-11-18 16:50 +0000
Re: Python Interview Questions "D'Arcy J.M. Cain" <darcy@druid.net> - 2012-11-18 12:16 -0500
Re: Python Interview Questions Roy Smith <roy@panix.com> - 2012-11-18 12:53 -0500
Re: Python Interview Questions Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-11-19 00:31 +0000
Re: Python Interview Questions Roy Smith <roy@panix.com> - 2012-11-18 21:09 -0500
Re: Python Interview Questions Chris Angelico <rosuav@gmail.com> - 2012-11-19 13:18 +1100
Re: Python Interview Questions Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-11-19 02:42 +0000
Re: Python Interview Questions Ian Kelly <ian.g.kelly@gmail.com> - 2012-11-18 23:01 -0700
Re: Python Interview Questions Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-11-19 07:54 +0000
Re: Python Interview Questions Roy Smith <roy@panix.com> - 2012-11-19 09:30 -0500
Re: Python Interview Questions Ian Kelly <ian.g.kelly@gmail.com> - 2012-11-19 09:44 -0700
Re: Python Interview Questions Terry Reedy <tjreedy@udel.edu> - 2012-11-19 15:41 -0500
Re: Python Interview Questions Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-11-19 23:42 +0000
Re: Python Interview Questions Roy Smith <roy@panix.com> - 2012-11-19 21:33 -0500
Re: Python Interview Questions Roy Smith <roy@panix.com> - 2012-11-19 09:59 -0500
Re: Python Interview Questions Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-11-19 23:53 +0000
Re: Python Interview Questions Roy Smith <roy@panix.com> - 2012-11-19 22:14 -0500
RE: Python Interview Questions "Prasad, Ramit" <ramit.prasad@jpmorgan.com> - 2012-11-19 23:57 +0000
Re: Python Interview Questions Terry Reedy <tjreedy@udel.edu> - 2012-11-19 03:27 -0500
Re: Python Interview Questions Chris Angelico <rosuav@gmail.com> - 2012-11-19 07:02 +1100
csiph-web