Ben Finney <[EMAIL PROTECTED]> wrote:
>  [EMAIL PROTECTED] writes:
> 
> > Missing that, I think dict() and set() and tuple() and list()
> 
>  I often use these myself. They're slightly more explicit, which can
>  help when I want the reader not to have to think too much, and they're
>  not particularly verbose because the names are well-chosen and
>  short.

You can also do this with the dict() syntax

dict(a = 1, b = 2, c = 3)

which I find a lot more readable than

{ 'a' : 1, 'b' : 2, 'c' : 3 }

In a lot of circumstances.

The syntax isn't so great when you set things which aren't valid
keywords though...

eg

{ (1,2,3) : 'a', (4,5,6) : 'b' }

vs

dict([ ((1,2,3), 'a'), ((4,5,6), 'b') ])

-- 
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to