Creating a list with holes

eneskristo at gmail.com eneskristo at gmail.com
Fri Jan 3 10:30:08 EST 2014


On Friday, January 3, 2014 4:19:09 PM UTC+1, Larry.... at 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 ... )
> 
> 
> 
> Thanks!
> 
> -larry

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!
- Enes



More information about the Python-list mailing list