[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Color, unpacking to r,g,b and r,g,b,a - ValueError: too many values to unpack



On Thu, 18 Jun 2009, René Dudfield wrote:

This is useful if you want to unpack to r,g,b and not r,g,b,a
c = Color(1,2,3,4)
c.set_length(3)
r,g,b = c

what about:

r, g, b = c.rgb
r, g, b, a = c

?

hm i guess nonsensical 'cause not bw compat, and new code could do just:
r, g, b, _ = c

i don't know, but would vote for something bw compat, 'cause there is quite a lot of old pygame code out there that will probably not be ported and it's always nice to be able to run the old stuff with current libs (instead of trying to have some old pygame installations also besides the current that is used for new dev).

~Toni