Issue #4 new

Inconsistent behavior when adding Vec2 with empty tuples.

Panagiotis Mavrogiorgos
created an issue

I know that planar is not maintained anymore, but I thought I would mention the following, in case someone decides to use it.

There is inconsistent behavior when adding Vec2 instances with empty tuples. Line 3 should raise a TypeError. The problem presents itself only in python.

In [1]: from planar.py import Vec2

In [2]: v1 = Vec2(2, 3)

In [3]: () + v1
Out[3]: (2.0, 3.0)

In [4]: v1 + ()
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-4-79184a0990bc> in <module>()
----> 1 v1 + ()

TypeError: unsupported operand type(s) for +: 'Vec2' and 'tuple'

In [5]: from planar.c import Vec2

In [6]: v1 = Vec2(2, 3)

In [7]: () + v1
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-7-53c927a6389c> in <module>()
----> 1 () + v1

TypeError: can only concatenate tuple (not "planar.Vec2") to tuple

In [8]: v1 + ()
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-8-79184a0990bc> in <module>()
----> 1 v1 + ()

TypeError: unsupported operand type(s) for +: 'planar.Vec2' and 'tuple'