Matching __all__ to doc: bugfix or enhancement?
![](https://secure.gravatar.com/avatar/d6b9415353e04ffa6de5a8f3aaea0553.jpg?s=120&d=mm&r=g)
The timeit doc describes four public attributes. The current timeit.__all__ only lists one. http://bugs.python.org/issue17414 proposes to expand __all__ to include all four: -__all__ = ["Timer"] +__all__ = ["Timer", "timeit", "repeat", "default_timer"] The effect of the change is a) help(timit) will mention the three functions as well as the class; b) IDLE's attribute completion box* will list all four instead just Timer; c) unknow other users of .__all__ will see the expanded list, for better or worse. * Typing 'xxx.' and either waiting or typing cntl-space brings up a listbox of attributes to select from. Is the code change an all-version bugfix or a default-only enhancement? I can see it both ways, but a decision is required to act. PS: I think the devguide should gain a new 'Behavior versus Enhancement' section after the current "11.1.2. Type" to clarify issues like this. -- Terry Jan Reedy
![](https://secure.gravatar.com/avatar/43bc83462d0c9d7f65a783c00f9189ad.jpg?s=120&d=mm&r=g)
On Thu, Mar 14, 2013 at 9:33 PM, Terry Reedy <tjreedy@udel.edu> wrote:
Is the code change an all-version bugfix or a default-only enhancement? I can see it both ways, but a decision is required to act.
This is actually backward-incompatible, so should not be considered a simple bugfix. If determined to be desirable, it should not be applied to any version before 3.4. -Fred -- Fred L. Drake, Jr. <fred at fdrake.net> "A storm broke loose in my mind." --Albert Einstein
![](https://secure.gravatar.com/avatar/fc761ccaf6c0d7d977e2959f9bfebd06.jpg?s=120&d=mm&r=g)
On Thu, Mar 14, 2013 at 6:33 PM, Terry Reedy <tjreedy@udel.edu> wrote:
The timeit doc describes four public attributes. The current timeit.__all__ only lists one. http://bugs.python.org/**issue17414 <http://bugs.python.org/issue17414> proposes to expand __all__ to include all four: -__all__ = ["Timer"] +__all__ = ["Timer", "timeit", "repeat", "default_timer"]
The effect of the change is a) help(timit) will mention the three functions as well as the class; b) IDLE's attribute completion box* will list all four instead just Timer; c) unknow other users of .__all__ will see the expanded list, for better or worse.
Another effect is that existing code that does: from timeit import * May break. The above may not be the recommended best practice in Python, but it's perfectly valid and widely used. Eli
![](https://secure.gravatar.com/avatar/047f2332cde3730f1ed661eebb0c5686.jpg?s=120&d=mm&r=g)
So it's a new feature, albeit a small one. I do see that it shouldn't be backported, but I don't see any worries about doing it in 3.4. Adding new functions/classes/constants to modules happens all the time, and we never give a second thought to users of import *. :-) On Thu, Mar 14, 2013 at 6:54 PM, Eli Bendersky <eliben@gmail.com> wrote:
On Thu, Mar 14, 2013 at 6:33 PM, Terry Reedy <tjreedy@udel.edu> wrote:
The timeit doc describes four public attributes. The current timeit.__all__ only lists one. http://bugs.python.org/issue17414 proposes to expand __all__ to include all four: -__all__ = ["Timer"] +__all__ = ["Timer", "timeit", "repeat", "default_timer"]
The effect of the change is a) help(timit) will mention the three functions as well as the class; b) IDLE's attribute completion box* will list all four instead just Timer; c) unknow other users of .__all__ will see the expanded list, for better or worse.
Another effect is that existing code that does:
from timeit import *
May break. The above may not be the recommended best practice in Python, but it's perfectly valid and widely used.
Eli
_______________________________________________ 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/guido%40python.org
-- --Guido van Rossum (python.org/~guido)
![](https://secure.gravatar.com/avatar/fc761ccaf6c0d7d977e2959f9bfebd06.jpg?s=120&d=mm&r=g)
On Thu, Mar 14, 2013 at 9:15 PM, Guido van Rossum <guido@python.org> wrote:
So it's a new feature, albeit a small one. I do see that it shouldn't be backported, but I don't see any worries about doing it in 3.4. Adding new functions/classes/constants to modules happens all the time, and we never give a second thought to users of import *. :-)
Oh yes, I agree there should be no problem in the default branch. My comment was mainly aimed at backporting it; I should've made it clearer. Eli
On Thu, Mar 14, 2013 at 6:54 PM, Eli Bendersky <eliben@gmail.com> wrote:
On Thu, Mar 14, 2013 at 6:33 PM, Terry Reedy <tjreedy@udel.edu> wrote:
The timeit doc describes four public attributes. The current timeit.__all__ only lists one. http://bugs.python.org/issue17414 proposes to expand __all__ to include all four: -__all__ = ["Timer"] +__all__ = ["Timer", "timeit", "repeat", "default_timer"]
The effect of the change is a) help(timit) will mention the three functions as well as the class; b) IDLE's attribute completion box* will list all four instead just
Timer;
c) unknow other users of .__all__ will see the expanded list, for better or worse.
Another effect is that existing code that does:
from timeit import *
May break. The above may not be the recommended best practice in Python, but it's perfectly valid and widely used.
Eli
_______________________________________________ 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/guido%40python.org
-- --Guido van Rossum (python.org/~guido)
![](https://secure.gravatar.com/avatar/d6b9415353e04ffa6de5a8f3aaea0553.jpg?s=120&d=mm&r=g)
On 3/15/2013 12:15 AM, Guido van Rossum wrote:
So it's a new feature, albeit a small one. I do see that it shouldn't be backported, but I don't see any worries about doing it in 3.4. Adding new functions/classes/constants to modules happens all the time, and we never give a second thought to users of import *. :-)
Thanks all. Pushed to 3.4 only. -- Terry Jan Reedy
participants (4)
-
Eli Bendersky
-
Fred Drake
-
Guido van Rossum
-
Terry Reedy