Can't get items out of a set?

Raymond Hettinger python at rcn.com
Sun Mar 9 18:36:40 CET 2008


> > The intern() builtin uses this approach:
>
> >    interned = {}
> >    def intern(s):
> >         if s in interned:
> >             return interned[s]
> >         interned[s] = s
> >         return s
>
> If you've seen it before, and have the old one, return the old one.
> Do I have this straight?

Right.




More information about the Python-list mailing list