What was that syntax again?
Someone (Dethe? Ian?) showed me syntax I'd never seen before around Python dictionary defining, involving an equal sign I thought. Tried searching my gmail, other things. Maybe faster to just ask: what was that syntax again? Kirby
Is this what you're looking for:
d = dict(key1=52, key2=12) d {'key2': 12, 'key1': 52}
Of course this only works for keys that are strings. --John On Tuesday 15 August 2006 1:28 am, kirby urner wrote:
Someone (Dethe? Ian?) showed me syntax I'd never seen before around Python dictionary defining, involving an equal sign I thought. Tried searching my gmail, other things. Maybe faster to just ask: what was that syntax again?
Kirby _______________________________________________ Edu-sig mailing list Edu-sig@python.org http://mail.python.org/mailman/listinfo/edu-sig
-- John M. Zelle, Ph.D. Wartburg College Professor of Computer Science Waverly, IA john.zelle@wartburg.edu (319) 352-8360
Yes, thank you. I was forgetting that this is ordinary function syntax, with assignment (dict being the function). I was trying to do it with curly braces. Kirby On 8/15/06, John Zelle <john.zelle@wartburg.edu> wrote:
Is this what you're looking for:
d = dict(key1=52, key2=12) d {'key2': 12, 'key1': 52}
Of course this only works for keys that are strings.
--John
On Tuesday 15 August 2006 1:28 am, kirby urner wrote:
Someone (Dethe? Ian?) showed me syntax I'd never seen before around Python dictionary defining, involving an equal sign I thought. Tried searching my gmail, other things. Maybe faster to just ask: what was that syntax again?
Kirby _______________________________________________ Edu-sig mailing list Edu-sig@python.org http://mail.python.org/mailman/listinfo/edu-sig
-- John M. Zelle, Ph.D. Wartburg College Professor of Computer Science Waverly, IA john.zelle@wartburg.edu (319) 352-8360
participants (2)
-
John Zelle -
kirby urner