(self, v)
return result
Returns the given color from the palette.

        Values are cached: if the specific value given has already been
        looked up, its value will be returned from the cache instead of
        calculating it again. Use L{Palette.clear_cache} to clear the cache
        if necessary.

        @note: you shouldn't override this method in subclasses, override
          L{_get} instead. If you override this method, lookups in the
          L{known_colors} dict won't work, so you won't be able to refer to
          colors by names or RGBA quadruplets, only by integer indices. The
          caching functionality will disappear as well. However,
          feel free to override this method if this is exactly the behaviour
          you want.

        @param v: the color to be retrieved. If it is an integer, it is
          passed to L{Palette._get} to be translated to an RGBA quadruplet.
          Otherwise it is passed to L{color_name_to_rgb()} to determine the
          RGBA values.

        @return: the color as an RGBA quadruplet
Returns the given color from the palette.
Returns the given color from the palette .
def get(self, v):
        """Returns the given color from the palette.

        Values are cached: if the specific value given has already been
        looked up, its value will be returned from the cache instead of
        calculating it again. Use L{Palette.clear_cache} to clear the cache
        if necessary.

        @note: you shouldn't override this method in subclasses, override
          L{_get} instead. If you override this method, lookups in the
          L{known_colors} dict won't work, so you won't be able to refer to
          colors by names or RGBA quadruplets, only by integer indices. The
          caching functionality will disappear as well. However,
          feel free to override this method if this is exactly the behaviour
          you want.

        @param v: the color to be retrieved. If it is an integer, it is
          passed to L{Palette._get} to be translated to an RGBA quadruplet.
          Otherwise it is passed to L{color_name_to_rgb()} to determine the
          RGBA values.

        @return: the color as an RGBA quadruplet"""
        if isinstance(v, list):
            v = tuple(v)
        try:
            return self._cache[v]
        except KeyError:
            pass
        if isinstance(v, int):
            if v < 0:
                raise IndexError("color index must be non-negative")
            if v >= self._length:
                raise IndexError("color index too large")
            result = self._get(v)
        else:
            result = color_name_to_rgba(v)
        self._cache[v] = result
        return result
def get ( self , v ) : if isinstance ( v , list ) : v = tuple ( v ) try : return self . _cache [ v ] except KeyError : pass if isinstance ( v , int ) : if v < 0 : raise IndexError ( "color index must be non-negative" ) if v >= self . _length : raise IndexError ( "color index too large" ) result = self . _get ( v ) else : result = color_name_to_rgba ( v ) self . _cache [ v ] = result return result