[Bf-committers] Re: [Bf-blender-cvs] CVS
commit: blender/release/scripts bevel_center.py
Campbell Barton
cbarton at metavr.com
Fri Feb 24 06:06:10 CET 2006
Joe Eagar wrote:
> Campbell Barton wrote:
>> campbellbarton (Campbell Barton) 2006/02/24 05:03:15 CET
>>
>> Modified files:
>> blender/release/scripts bevel_center.py Log:
>> Should now work with python 2.3, also optimized dictionary's a bit.
>> keys -> iterkeys and has_key -> try/except
>> Revision Changes Path
>>
> I thought has_key was written specifically to be more optimized then
> try/except?
>
> joeedh
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at projects.blender.org
> http://projects.blender.org/mailman/listinfo/bf-committers
>
has_key is probably marginaly faster then try/except. But in the case
where your checking for the key, and assigning to the dict if the keys
not there- Its faster to do 1 dict lookup with an exception then 2 dict
lookups.
Cam
--
Campbell J Barton
133 Hope Street
Geelong West, Victoria 3218 Australia
URL: http://www.metavr.com
e-mail: cbarton at metavr.com
phone: AU (03) 5229 0241
More information about the Bf-committers
mailing list