On a similar note, here's a question I recently asked and obtained good input about tail recursion optimization. http://stackoverflow.com/questions/1414581/python-recursive-program-to-prime-factorize-a-number
On Wed, Oct 21, 2009 at 1:14 PM, Sidharth Kuruvila < sidharth.kuruv...@gmail.com> wrote: > Hi, > My bad, that was a bit of laziness on my part. The reason why my > code was silly is not to do with interning though that does happen for > strings. Literals, that is numbers and string literals and a few > others are loaded as constants. So the cost of constructing them in > your code has already been taken care of. > > A better example would be something like > > d = {"a":[1,2,3,4]} > > print d.setdefault("a", []) > > > Interning is an optimization done to speed up the comparison of > strings, by making sure that two string with the same text are > represented by the same object. > > Regards, > Sidharth > > > On Wed, Oct 21, 2009 at 12:31 PM, Anand Chitipothu <anandol...@gmail.com> > wrote: > >> What do you mean when you use the word "interned"? > > > > $ pydoc intern > > Help on built-in function intern in module __builtin__: > > > > intern(...) > > intern(string) -> string > > > > ``Intern'' the given string. This enters the string in the (global) > > table of interned strings whose purpose is to speed up dictionary > lookups. > > Return the string itself or the previously interned string object with > the > > same value. > > _______________________________________________ > > BangPypers mailing list > > BangPypers@python.org > > http://mail.python.org/mailman/listinfo/bangpypers > > > > > > -- > I am but a man. > _______________________________________________ > BangPypers mailing list > BangPypers@python.org > http://mail.python.org/mailman/listinfo/bangpypers > -- Regards, Lakshman becomingguru.com lakshmanprasad.com _______________________________________________ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers