[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 Wed, Jun 17, 2009 at 6:12 PM, René Dudfield <renesd@xxxxxxxxx> wrote:
Yeah, that's another option to consider.  Except returning Color is so
much nicer to use than a tuple for colors (and slightly quicker... but
that's not a big point).  Also it should be more consistent to have
all the methods returning Colors for colors.

My response on the consistency front would be:
1. that I would rather a color object be consistent in how it "unpacks" than be inconsistent based on some length option for the sake of old code
2. the new version of pygame would not be adding any new inconsistency by making the palette stuff return 3-tuples instead of color object - clearly the palette functions were already inconsistent with the rest of color-getting functions, otherwise we wouldn't have this problem to deal with.

... so I assume a palette can not take alpha, which is why the functions didn't return one, right? it seems like to have those functions return an object which even has an alpha member would be an opportunity to allow for confusion about what should work.