Simple question on Parameters...

Jean-Paul Calderone exarkun at divmod.com
Wed Dec 28 15:46:26 EST 2005


On 28 Dec 2005 12:37:32 -0800, KraftDiner <bobrien18 at yahoo.com> wrote:
>I have defined a method as follows:
>
>def renderABezierPath(self, path, closePath=True, r=1.0, g=1.0, b=1.0,
>a=1.0, fr=0.0, fg=0.0, fb=0.0, fa=.25):
>
>Now wouldn't it be simpler if it was:
>
>def renderABezierPath(self, path, closePath=True, outlineColor,
>fillColor):
>
>But how do you set default vaules for outlineColor and fillColors?
>Like should these be simple lists or should they be structures or
>classes...

  def renderABezierPath(self, path, closePath=True,
                        outlineColor=(1, 1, 1),
                        fillColor=(0, 0, 0.25)):
      ...

Jean-Paul



More information about the Python-list mailing list