On 01/02/2014 14:40, Roy Smith wrote:
In article <mailman.6275.1391257695.18130.python-l...@python.org>,
  Ned Batchelder <n...@nedbatchelder.com> wrote:

The existence of __new__ is an
advanced topic that many programmers never encounter.  Taking a quick
scan through some large projects (Django, edX, SQLAlchemy, mako), the
ratio of __new__ implementations to __init__ implementations ranges from
0% to 1.5%, which falls into "rare" territory for me.

 From our own codebase:

$ find . -name '*.py' | xargs grep 'def.*__new__' | wc -l
1
$ find . -name '*.py' | xargs grep 'def.*__init__' | wc -l
228

Doing the same searches over all the .py files in our virtualenv, I get
2830 (__init__) vs. 50 (__new__).


You could remove all 228 __init__ and still get your code to work by scattering object attributes anywhere you like, something I believe you can't do in C++/Java. I doubt that you could remove the single __new__ and get your code to work.

--
My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language.

Mark Lawrence

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to