Computer Science question (python list is slow with my cruddy algorithm )

Duncan Booth duncan at NOSPAMrcp.co.uk
Fri Aug 23 10:49:42 EDT 2002


Terry Hancock <hancock at anansispaceworks.com> wrote in 
news:mailman.1030106632.6188.python-list at python.org:

> world = {}
> world[(x, y)] = ( tuple of properties )

You can drop a lot of the parentheses from that expression.
    world[x, y]
works just as well as world[(x, y)] and is much easier to type.
You don't need parentheses around the tuple of properties either, although 
some people prefer it.

> 
> Then
> 
> world.get( (x,y), default=( empty square properties ))
> 
You do however need all the parentheses in this one.


-- 
Duncan Booth                                             duncan at rcp.co.uk
int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3"
"\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?



More information about the Python-list mailing list