Hi,
PEP 289 says:
(Loop variables may also use constructs like x[i] or x.a; this form may be deprecated.)
What is this about? I found this:
19:41:33:232:35 >>> a=Test()
19:41:37:232:36 >>> for a.foo in L: print a.foo
19:41:37:232:36 ...
<__main__.Tes t object at 0x4018516c>
<__main__.Tes t object at 0x401854cc>
<__main__.Tes t object at 0x401854ac>
19:41:49:232:37 >>> for obj in L: print obj.foo,
19:41:49:232:37 ...
bar baz bax
What is the use of this? When should I use it? Why 'may it be deprecated'?
I don't see this construct in the Language Reference. I looked at:
yours probably,
Gerrit.
--
that he caught run away from him, then shall he swear
to the owners of the slave, and he is free of all blame.
-- 1780 BC, Hammurabi, Code of Law
--
Asperger Syndroom - een persoonlijke benadering:
Kom in verzet tegen dit kabinet:
PEP 289 says:
(Loop variables may also use constructs like x[i] or x.a; this form may be deprecated.)
What is this about? I found this:
19:41:33:232:35 >>> a=Test()
19:41:37:232:36 >>> for a.foo in L: print a.foo
19:41:37:232:36 ...
<__main__.Tes t object at 0x4018516c>
<__main__.Tes t object at 0x401854cc>
<__main__.Tes t object at 0x401854ac>
19:41:49:232:37 >>> for obj in L: print obj.foo,
19:41:49:232:37 ...
bar baz bax
What is the use of this? When should I use it? Why 'may it be deprecated'?
I don't see this construct in the Language Reference. I looked at:
yours probably,
Gerrit.
--
that he caught run away from him, then shall he swear
to the owners of the slave, and he is free of all blame.
-- 1780 BC, Hammurabi, Code of Law
--
Asperger Syndroom - een persoonlijke benadering:
Kom in verzet tegen dit kabinet:
Comment