Doesn't know what it wants

Tim Rau bladedpenguin at gmail.com
Sat Jan 26 01:45:07 EST 2008


On Jan 26, 1:32 am, Jeroen Ruigrok van der Werven <asmo... at in-
nomine.org> wrote:
> -On [20080126 06:26], Tim Rau (bladedpeng... at gmail.com) wrote:
>
> >Line 147 reads:
> >        moi = cp.cpMomentForCircle(self.mass, .2, 0, vec2d((0,0)))
>
> I think it expects something like:
>
> # badly named variable, pick something better depending on context
> temp = vec2d(0, 0)
> cp.cpMomentForCircle(self.mass, .2, 0, temp)
>
> I am curious about your use of double braces for vec2d though. Why ((0,0)) and
> not (0, 0)?

the double parens are a tuple being passed as an argument. vec2d is
not a constructor that cares whether it gets a tuple or a pair of
ints. I choose tuple for consistency with the rest of my code.  Isn't
what it gets the value returned by the constructor, no matter whether
you assign it to an intermediate value first? I tried it, and the
result is the same.



More information about the Python-list mailing list