Hi,

that's a good point.

TLDR; I think it should be on by default too. There's still a couple of
issues with doing that.


It should have _no_ cost in almost all cases for attribute access. Because
it first tries normal attribute access.
See: https://github.com/pygame/pygame/blob/master/src/math.c#L1517

I guess the reason is it's off by default is because it was implemented
later on, and to leave it on in a buggy state caused issues.

Not a big concern, but turning it on by default will perhaps have annoying
compatibility issues for people using an old pygame.
If they forget to turn it on.

There's two test failures once I changed to be enabled by default:

>>> import pygame.math
>>> v = pygame.math.Vector2(1,2)
>>> v.x = 3
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: a sequence is expected
>>> pygame.math.disable_swizzling()
>>> v.x = 3
>>> v
<Vector2(3, 2)>

These are to do with assignment to a variable.
https://github.com/pygame/pygame/pull/403




On Sat, Feb 24, 2018 at 7:23 PM, Daniel Pope <ma...@mauveweb.co.uk> wrote:

> Does the Swizzling have a cost if you're not using it? If not I'd be
> tempted to say it should always be on.
>
>
> On Sat, 24 Feb 2018, 18:00 René Dudfield, <ren...@gmail.com> wrote:
>
>> Hey hey,
>>
>> I noticed the pygame.math vectors couldn't be pickled/unpickled.
>>
>> So that has been added here:
>> https://github.com/pygame/pygame/pull/403
>>
>> Could someone please review?
>>
>>
>> cheers,
>>
>>
>>
>> On Sat, Feb 24, 2018 at 10:30 AM, René Dudfield <ren...@gmail.com> wrote:
>>
>>> Hello,
>>>
>>> I'm going to remove the experimental notice from pygame.math in the docs.
>>> https://www.pygame.org/docs/ref/math.html
>>>
>>> It seems fine to me, and I guess no one has plans to change it?
>>>
>>>
>>> best regards,
>>>
>>
>>

Reply via email to