On 7/11/06, Terry Reedy <[EMAIL PROTECTED]> wrote:

> >>> d={1:'one', 1.0:'one'}
> >>> d
> {1: 'one'}

This highlights the problem. Imagine that you don't type out the
actual objects, but just receive them:

def make_dict(x, y, obj):
    return {x: obj, y: obj}

x1 = x2 = "fish"
d = make_dict(x1, x2, 1337)


Here I don't really care if a and b are the same or not, I just care
that I can do d[x1] and d[x2].

(Of course this is a dangerous path to go down too deep, what about
del d[x1] ? And who would make such code, anyway?)


Maybe only for the literal values and direct variable names..?

Is the following behaviour as expected, or is it just The Lock?


import threading

count = 0
def counter():
    global count
    while True:
        count += 1

threading.Thread(target=counter).start()

>>> {count-1+1: 1, count: 2, count-1+1: 3, count: 4, count: 5, count:
6, count: 7, count: 8, count-1+1: 9, count: 10, count: 11}
{897203081: 11}


-- 
Stian Søiland               Any society that would give up a little
Manchester, UK              liberty to gain a little security will
http://soiland.no/          deserve neither and lose both. [Franklin]
                     =/\=
_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to