james_027 wrote:
> hi,
> 
> a_dict = {'name':'apple', 'color':'red', 'texture':'smooth',
> 'shape':'sphere'}
> 
> is there any difference between ..
> 
> for key in a_dict:
> 
> from
> 
> for key in a_dict.keys():
> 
> 
> which is more preferred?

Use the first.

any difference in performance?

It doesn't matter. Wait until later to do these types of optimizations. 
Ask the list how to go about optimizing when the time comes.

James


-- 
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095

http://www.jamesstroud.com/
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to