[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] API draft for vector type



On Wed, Apr 29, 2009 at 11:02:58PM +0200, Lorenz Quack wrote:
> Marius Gedminas wrote:
>> On Tue, Apr 28, 2009 at 06:32:12PM +0200, Lorenz Quack wrote:
>>>>> 1.5.4.1  v.isNormalized() -> bool
>>>>> 1.5.4.2  v.normalize() -> None    # normalizes inplace
>>>>> 1.5.4.3  v1.normalized() -> v2    # returns normalized vector
>>>> In my opinion normalize() and normalized() are far too ambiguous. We
>>>> might should use something like ip_XXX() for inplace operations:
>>>>
>>>>   v.ip_normalize () -> None
>>>>   v.normalize () -> v2
>>>>
>>>> We do that naming already for Rect objects and should take care of doing
>>>> that anywhere where inplace operations happen. The same then applies to
>>>> the rest of your inplace methods.
>>> hm. ok. but the ip is after the name: v.normalize_ip()
>>
>> When I see 'ip', I cannot stop thinking about IP addresses.
>>
>> I think .normalize() vs .normalized() is clear enough, and also follows
>> the convention set by Python builtins (list.sort() vs sorted()).
>
> I personally also prefer .normalize() and .normalized() but if there is 
> also a precedence like with rect in this case I prefer consistency over 
> my personal taste.

Consistency within pygame trumps consistency with the stdlib.  I'd
forgotten about Rect's _up convention, and was evidently not paying
attention to the original quoted text ("We do that naming already for
Rect objects").

Marius Gedminas
-- 
Some of the more environmentally aware dinosaurs were worried about the
consequences of an accident with the new Iridium enriched fusion reactor.
"If it goes off only the cockroaches and mammals will survive..." they said.

Attachment: signature.asc
Description: Digital signature