[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] euclid.Vector2 to pygame coordinate tuple shortcut?
Jake b wrote:
I thought I had used the "*" operator ( to imply this?), but maybe not.
The *-operator expands the sequence passed to different argument slots,
so unless the method takes both a tuple of 2 values and two separate
arguments, it will not work. :-)
E.g.:
b = (a, c)
f(a, *b, c) becomes f(a, a, c, c), and
f(a, tuple(b), c) becomes f(a, (a, b), c).
While it's possible to do support both syntaxes in any kind of
argument-list, it's clumsy and ugly to support both unless they're at
the end of the argument list. :-)
(For simple methods you can do something like
def foo(x, y=None):
if y is None:
x, y = x
... normal stuff)
Sorry if I misinterpreted you.
--
Kindest regards, Jørgen.