How can I create customized classes that have similar properties as 'str'?

George Sakkis george.sakkis at gmail.com
Sun Nov 25 00:55:55 EST 2007


On Nov 24, 7:42 pm, Steven D'Aprano

> > To the OP: yes, your use case is quite valid; the keyword you are
> > looking for is "memoize". You can find around a dozen of recipes in the
> > Cookbook and posted in this list; here's one starting point:
> >http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/413717.
>
> This has nothing, absolutely NOTHING, to do with memoization. Memoization
> trades off memory for time, allowing slow functions to return results
> faster at the cost of using more memory. The OP wants to save memory, not
> use more of it.

If you bothered to click on that link you would learn that memoization
can be used to save space too and matches OP's case exactly; even the
identity tests work. Self-importance is bad enough by itself, even
without the ignorance, but you seem to do great in both.

George



More information about the Python-list mailing list