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


Groups > comp.lang.python > #63064

Re: Creating a list with holes

References <mailman.4852.1388762356.18130.python-list@python.org> <c37ad1f1-1367-4de0-9a2e-bc60355abea3@googlegroups.com>
Date 2014-01-03 10:41 -0500
Subject Re: Creating a list with holes
From Larry Martell <larry.martell@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.4856.1388763689.18130.python-list@python.org> (permalink)

Show all headers | View raw


On Fri, Jan 3, 2014 at 10:30 AM,  <eneskristo@gmail.com> wrote:
> On Friday, January 3, 2014 4:19:09 PM UTC+1, Larry....@gmail.com wrote:
>> I think I know the answer is no, but is there any package that allows
>>
>> creating a list with holes in it? E.g. I'd want to do something like:
>>
>> x[10] = 12
>> x[20] = 30
>>
>> I'm thinking of something like defaultdict but for lists (I know
>>
>> that's very different, but ... )
>
> Hello Larry!
>
> The thing is, where to put the holes? A costum function can be made if you want the hole to be placed for example:
> 1. In random
> 2. Every nth hole(Or with another sequence)
> 3. In the beginning or end.
>
> Please tell me how do you want them, and I will try my best to help!

The holes would be between the items I put in. In my example above, if
I assigned to [10] and [20], then the other items ([0..9] and
[11..19]) would have None.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Creating a list with holes Larry Martell <larry.martell@gmail.com> - 2014-01-03 10:19 -0500
  Re: Creating a list with holes eneskristo@gmail.com - 2014-01-03 07:30 -0800
    Re: Creating a list with holes Larry Martell <larry.martell@gmail.com> - 2014-01-03 10:41 -0500
      Re: Creating a list with holes Denis McMahon <denismfmcmahon@gmail.com> - 2014-01-03 18:07 +0000
        Re: Creating a list with holes Larry Martell <larry.martell@gmail.com> - 2014-01-03 19:15 -0500
          Re: Creating a list with holes Roy Smith <roy@panix.com> - 2014-01-03 20:18 -0500
            Re: Creating a list with holes Denis McMahon <denismfmcmahon@gmail.com> - 2014-01-04 02:03 +0000
  Re: Creating a list with holes Roy Smith <roy@panix.com> - 2014-01-03 10:38 -0500
    Re: Creating a list with holes Chris Angelico <rosuav@gmail.com> - 2014-01-04 02:46 +1100

csiph-web