Josiah Carlson wrote:
> In a recent source checkout of the trunk Lib, there are 100+ uses of setattr, 
> 400+ uses of getattr (perhaps 10-20% of which being the 3 argument form), and 
> a trivial number of delattr calls.
I just duplicated this test on all the .py files in the Lib directory 
tree of a freshly updated 2.5 trunk.  The results:
  228  1119 18032 sets
  679  3547 52532 gets
   30   105  2003 dels
  937  4771 72567 total

Here's wc on all those .py files:
471821 1659218 16585060 total

So 937 lines out of 471,821 lines called *attr() functions, or very 
nearly 0.2%.

I'm now totally convinced: +1 on attrview(), -1 on a syntax change.  
This is a minor improvement for 1 out of every 500 lines, and the class 
arguably nicer anyway.

(Of the syntax changes, I still prefer ".[]".)


/larry/
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to