In message [EMAIL PROTECTED],
james_027 wrote:
is there any difference between ..
for key in a_dict:
from
for key in a_dict.keys():
I'm assuming the former is equivalent to
for key in a_dict.iterkeys() :
--
http://mail.python.org/mailman/listinfo/python-list
On Aug 25, 7:41 am, Lawrence D'Oliveiro [EMAIL PROTECTED]
central.gen.new_zealand wrote:
In message [EMAIL PROTECTED],
james_027 wrote:
is there any difference between ..
for key in a_dict:
from
for key in a_dict.keys():
I'm assuming the former is equivalent to
for key in
On Sat, 25 Aug 2007 19:05:07 +, Dustan wrote:
Never assume. A better approach would be to experiment:
I assume that you would not like it if I poked you in the eye with a
sharp stick, but perhaps I better experiment...
*wink*
More seriously, if you wish to compare dict.keys() and
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? any difference in performance?
THanks
james
--
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