A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/attachments/20150106/739f469b/attachment.html below:

<div dir="ltr">I thought of this exact comment when I read the "bug fix considered a regression."</div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jan 6, 2015 at 2:41 PM, Guido van Rossum <span dir="ltr"><<a href="mailto:guido@python.org" target="_blank">guido@python.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">There's an obligatory XKCD reference for this: <a href="http://xkcd.com/1172/" target="_blank">http://xkcd.com/1172/</a><br></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Tue, Jan 6, 2015 at 12:25 PM, Terry Reedy <span dir="ltr"><<a href="mailto:tjreedy@udel.edu" target="_blank">tjreedy@udel.edu</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div><div>On 1/6/2015 7:39 AM, Victor Stinner wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
More context:<br>
<br>
2014-12-19 12:43 GMT+01:00 anatoly techtonik <<a href="mailto:techtonik@gmail.com" target="_blank">techtonik@gmail.com</a>>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<a href="https://github.com/nickstenning/honcho/pull/121" target="_blank">https://github.com/<u></u>nickstenning/honcho/pull/121</a><br>
</blockquote>
<br>
The link mentions the following changeset:<br>
---<br>
changeset:  Â 93122:1a3143752db2<br>
branch:  Â  Â  2.7<br>
parent:  Â  Â  93112:927cca0b9337<br>
user:  Â  Â  Â  R David Murray <<a href="mailto:rdmurray@bitdance.com" target="_blank">rdmurray@bitdance.com</a>><br>
date:  Â  Â  Â  Fri Oct 17 20:07:08 2014 -0400<br>
files:  Â  Â  Â Lib/argparse.py Lib/test/test_argparse.py Misc/NEWS<br>
description:<br>
#9351: set_defaults on subparser is no longer ignored if set on parent.<br>
<br>
Before, if a default was set on the parent parser, any default for that<br>
variable set via set_defaults on a subparser would be ignored.  Now<br>
the subparser set_defaults is honored.<br>
<br>
Patch by Jyrki Pullianinen.<br>
<br>
<br>
diff -r 927cca0b9337 -r 1a3143752db2 Lib/argparse.py<br>
--- a/Lib/argparse.py  Â Fri Oct 17 16:20:15 2014 -0500<br>
+++ b/Lib/argparse.py  Â Fri Oct 17 20:07:08 2014 -0400<br>
@@ -1089,7 +1089,14 @@ class _SubParsersAction(Action):<br>
  Â  Â  Â  Â  # parse all the remaining options into the namespace<br>
  Â  Â  Â  Â  # store any unrecognized options on the object, so that the top<br>
  Â  Â  Â  Â  # level parser can decide what to do with them<br>
-  Â  Â  Â  namespace, arg_strings = parser.parse_known_args(arg_<u></u>strings,<br>
namespace)<br>
+<br>
+  Â  Â  Â  # In case this subparser defines new defaults, we parse them<br>
+  Â  Â  Â  # in a new namespace object and then update the original<br>
+  Â  Â  Â  # namespace for the relevant parts.<br>
+  Â  Â  Â  subnamespace, arg_strings = parser.parse_known_args(arg_<u></u>strings, None)<br>
+  Â  Â  Â  for key, value in vars(subnamespace).items():<br>
+  Â  Â  Â  Â  Â  setattr(namespace, key, value)<br>
+<br>
  Â  Â  Â  Â  if arg_strings:<br>
  Â  Â  Â  Â  Â  Â  vars(namespace).setdefault(_<u></u>UNRECOGNIZED_ARGS_ATTR, [])<br>
  Â  Â  Â  Â  Â  Â  getattr(namespace, _UNRECOGNIZED_ARGS_ATTR).<u></u>extend(arg_strings)<br>
---<br>
<br>
Which is related to <a href="http://bugs.python.org/issue9351" target="_blank">http://bugs.python.org/<u></u>issue9351</a><br>
<br>
Maybe argparse just became more strict? I don't understand the issue.<br>
</blockquote>
<br></div></div>
Steven Bethard, the argparse maintainer, defined the old behavior of ignoring subparser defaults (where there are also top level defaults) as a bug "counter to what people probably expect".  If the old behavior had been documented, changing it in a bug-fix release would have been a mistake.  But looking at the patch, the doc seems to have been silent on the issue.<br>
<br>
This is not the first time someone considered a 'bug fix' to be a 'regression', which it might be from their viewpoint.  The last comment on the github thread suggests that an easy fix was found.<span><font color="#888888"><br>
<br>
-- <br>
Terry Jan Reedy</font></span></div></div><div><div><div><div class="h5"><br>
<br>
______________________________<u></u>_________________<br>
Python-Dev mailing list<br>
<a href="mailto:Python-Dev@python.org" target="_blank">Python-Dev@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-dev" target="_blank">https://mail.python.org/<u></u>mailman/listinfo/python-dev</a><br></div></div>
Unsubscribe: <a href="https://mail.python.org/mailman/options/python-dev/guido%40python.org" target="_blank">https://mail.python.org/<u></u>mailman/options/python-dev/<u></u>guido%40python.org</a><span class="HOEnZb"><font color="#888888"><br>
</font></span></div></div></blockquote></div><span class="HOEnZb"><font color="#888888"><br><br clear="all"><br>-- <br><div>--Guido van Rossum (<a href="http://python.org/~guido" target="_blank">python.org/~guido</a>)</div>
</font></span></div>
<br>_______________________________________________<br>
Python-Dev mailing list<br>
<a href="mailto:Python-Dev@python.org">Python-Dev@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-dev" target="_blank">https://mail.python.org/mailman/listinfo/python-dev</a><br>
Unsubscribe: <a href="https://mail.python.org/mailman/options/python-dev/rymg19%40gmail.com" target="_blank">https://mail.python.org/mailman/options/python-dev/rymg19%40gmail.com</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr">Ryan<div><div>If anybody ever asks me why I prefer C++ to C, my answer will be simple: "It's becauseslejfp23(@#Q*(E*EIdc-SEGFAULT. Wait, I don't think that was nul-terminated."</div></div>Personal reality distortion fields are immune to contradictory evidence. - srean<div>Check out my website: <a href="http://kirbyfan64.github.io/" target="_blank">http://kirbyfan64.github.io/</a></div></div></div>
</div>

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4