Python List Problem (now Solved)

I was programming in Python when I had a strange problem. My program stores data in a list, with a length of at least three. Indices 0 and 1 contain other data, but from index 2 and higher, the list contains dictionaries. The program needs to process each of the dictionaries, but only if there is something in the dictionary. I want a list_of_n values that are the index numbers of dictionaries with stuff in them.

Here is attempt one, and the output it produces:

def test(d = [0, 0, {}, {}, {'a':4}]):
   list_of_n = range( 2, len(d) )
   print( '!!! Y\'arr, we got ' + str(list_of_n) + ' here!' )
   for n in list_of_n:
      print( '... checkin\' out ' + str(n) )
      if {} == d[n]:
         list_of_n.remove( n )
         print( '--> removing ' + str(n) )
         print( '--> keeping ' + str(n) )
>>> test()
 !!! Y'arr, we got [2, 3, 4] here!
 ... checkin' out 2
 --> removing 2
 ... checkin' out 4
 --> keeping 4

What happens to 3?


Here is attempt two, which works:

def test(d = [0, 0, {}, {}, {'a':4}]):
   list_of_n = []
   for n in xrange( 2, len(d) ):
      print( '... checkin\' out ' + str(n) )
      if {} != d[n]:
         list_of_n.append( n )
         print( '--> adding ' + str(n) )
         print( '--> not adding ' + str(n) )
>>> test()
 ... checkin' out 2
 --> not adding 2
 ... checkin' out 3
 --> not adding 3
 ... checkin' out 4
 --> adding 4


Now, I admit that the second version is better than the first, and that I should have chosen it in the first place. But why doesn’t the first version work? What happens to 3?

New Fedora Spin for Audio Creation Needs Visual Artwork!

tl;dr (one sentence summary): We want Fedora community members to send us photos and graphics of their musical practices.

In the Fedora Audio Creation SIG, we’ve been talking about our own spin for years. This summer, we have a Google Summer of Code project underway to finish the spin, called Fedora Jam, for Fedora 18. Jørn Lomax is helping us coordinate the effort (see here).

Obviously, making a spin takes a lot of work, and Jørn can’t do it alone. In fact, the Audio Creation SIG can’t do it alone! After making our first live media for testing (see here), we’re thinking about the visual presentation of our spin, and we want your help!

We want the spin to reflect our community and our values, but we want to make this about more than the handful of the Audio Creation SIG’s most active contributors. If you’re a Fedora community member, and you want us to share your musical activities as part of the Fedora Jam spin’s visual identity, send us your photos and graphics!

Any photos of you or people you know, participating in any musical activity. Or, photos of your musical equipment (computerized or not).

Ideally, post a link here. You can also email me a link or the photos, and I can upload them for you.

Please ensure your contributions are subject to the CC-BY-SA 3.0 Unported licence.

People in Photos:
We intend to avoid faces in our spin’s artwork, but keep in mind that your contributions will be accessible to the Internet in an unmodified form. I recommend removing identifiable features of people before submitting photos, unless you are absolutely sure of what you’re doing.