Pointers

Michael Hudson mwh21 at cam.ac.uk
Wed Apr 19 11:12:08 CEST 2000


Thomas Wouters <thomas at xs4all.net> writes:

> But you have to force *both* strings this way, interning one isn't
> enough.  It also doesn't work for integers (i dont think there is a
> way to do it with ints) so the best solution is just to not rely on
> this behaviour.

Compiling the code they turn up in is one way:

>>> def f():
...    x = 100000
...    y = 100000
...    return x is y
... 
>>> f()   
1

But, yes.

M.

-- 
  well, take it from an old hand: the only reason it would be easier
  to program in C is that you can't easily express complex  problems
  in C, so you don't.                   -- Erik Naggum, comp.lang.lisp



More information about the Python-list mailing list