Modifying the {} and [] tokens

Geoff Howland ghowland at lupineNO.SPAMgames.com
Sat Aug 23 05:16:13 EDT 2003


On 23 Aug 2003 07:02:53 GMT, "OKB (not okblacke)" <BrenBarn at aol.com>
wrote:

>> {} + {}, {} - {}.  [] - [], etc
>
>    	I'm a little puzzled as to why you'd need these, since it seems 
>like all they allow you to is hard-code a certain combination of 
>statically defined objects.  That is, if you're going to do
>
>{ 'a': 1, 'b': 2 } + { 'c': 3, 'd': 4}
>
>    . . .why not just write
>
>{ 'a': 1, 'b': 2, 'c': 3, 'd': 4}
>
>    	in the first place?

Because I wouldn't just be using {} on a line, I would create a
dictionary with it and then use it around, and then at some point
later I may want to add another dictionary to it, or find the union or
differences between two dictionaries.

Ruby has this built in, it's useful, it's complete.  It's obvious what
is happening, so it's not unclean.  It's allowed for other containers.


-Geoff Howland
http://ludumdare.com/




More information about the Python-list mailing list