I'm wondering if it might be better creating a representation of the  
attributes in memory using dicts. The code I posted takes about a  
second at the moment and I'll need to do lots of lookups by attributes  
and I'll end up with thousands of tables.

I'll try those changes when I'm back at work on Friday.

Thx

Sent from my iPhone

On 25 Oct 2010, at 18:58, "David E. Sallis" <david.sal...@noaa.gov>  
wrote:

> David E. Sallis said the following on 10/25/2010 12:54 PM:
>
>> 3)  Next, the so-called 'double under' methods (__contains__(),  
>> __getattr__())
>> are generally intended for internal use only by their containing  
>> objects.  A
>> better way would be to use the 'in' operator; to wit (note also the  
>> binding of
>> node.attr.items()):
>>
>>    nodeAttrItems = node.attrs.items()
>>    if attrItems[0] not in nodeAttrItems: ...
>>    if nodeAttrItems[0] <> attrItems[1]: ...
>>
>>    Also if you did this you can eliminate your innermost loop.
>
> Whoops, brain fart.  I guess you still need to iterate through  
> attrItems, but
> the other suggestions might still improve your run time somewhat...
>
> -- 
> David E. Sallis, Senior Principal Engineer, Software
> General Dynamics Information Technology
> NOAA Coastal Data Development Center
> Stennis Space Center, Mississippi
> 228.688.3805
> david.sal...@gdit.com
> david.sal...@noaa.gov
> --------------------------------------------
> "Better Living Through Software Engineering"
> --------------------------------------------
>
> --- 
> --- 
> --- 
> ---------------------------------------------------------------------
> Nokia and AT&T present the 2010 Calling All Innovators-North America  
> contest
> Create new apps & games for the Nokia N8 for consumers in  U.S. and  
> Canada
> $10 million total in prizes - $4M cash, 500 devices, nearly $6M in  
> marketing
> Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi  
> Store
> http://p.sf.net/sfu/nokia-dev2dev
> _______________________________________________
> Pytables-users mailing list
> Pytables-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/pytables-users

------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Pytables-users mailing list
Pytables-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pytables-users

Reply via email to