[Tutor] Re: the address is the information- say what?

Emile van Sebille emile@fenx.com
Fri, 30 Aug 2002 18:26:47 -0700


Kirk:
> OK, we're getting metaphysical here.  This mantra haunts me from reading
> some stuff down at the public library. If indeed the address is the
> information, could we not reverse the process, and by providing
> information generate an address?
>
> 1. me
> 2. here
> 3. you
> 4. there
> 5. foo
> 6. pizza
> 7. snacks
> 8. pepto bismol
>
> Plug in key 6, you get pizza. Plug in pizza, get 6? Well, not with a
> dictionary, they can change placement at the interpreter's convince, but
> a list or tuple can do it.

I'm not sure what you'd do with it, but text string that can serve as
labels/variable names are interned, allowing you to do:

Python 2.1.3 (#35, Apr  8 2002, 17:47:50) [MSC 32 bit (Intel)] on win32
Type "copyright", "credits" or "license" for more information.
>>> ii = 'spam'
>>> id(ii)
8915248
>>> id('spam')
8915248
>>>


You're on your own for 'pepto bismol' however... ;-)

Emile van Sebille
emile@fenx.com