[issue34543] _struct.Struct: calling functions without calling __init__ results in SystemError

2018-09-02 Thread Steven D'Aprano
Steven D'Aprano added the comment: I've tried running this code in Python 3.6: from _struct import Struct for i in range(10): L = [Struct.__new__(Struct) for j in range(1000)] for s in L: try: x = s.pack_into(bytearray()) except S

[issue34543] _struct.Struct: calling functions without calling __init__ results in SystemError

2018-09-03 Thread Steven D'Aprano
Steven D'Aprano added the comment: Thanks for confirming the seg fault. I've changed this to a crasher. Should we change the exception to RuntimeError? -- components: +Library (Lib) -Extension Modules type: behavior -> crash ___ P

[issue34596] [unittest] raise error if @skip is used with an argument that looks like a test method

2018-09-06 Thread Steven D'Aprano
Steven D'Aprano added the comment: Is there a use-case for reason to be anything but a string? -- nosy: +steven.daprano ___ Python tracker <https://bugs.python.org/is

[issue34605] Avoid master/slave terminology

2018-09-07 Thread Steven D'Aprano
Steven D'Aprano added the comment: I strongly disagree with this as a general principle. "Master/slave" is a powerful, obvious metaphor which works well and is not the same as parent/child, server/client or employer/worker. In fact, in the BDSM subcultures, "master/slave

[issue34596] [unittest] raise error if @skip is used with an argument that looks like a test method

2018-09-09 Thread Steven D'Aprano
Steven D'Aprano added the comment: For what its worth, I'm +1 with Serhiy that we raise an exception on a non-string argument, including the case where the caller forgets to provide a reason at all. I don't think that @skip with no reason was ever intended to work (it c

[issue34644] Bug in reverse method

2018-09-12 Thread Steven D'Aprano
Steven D'Aprano added the comment: This is not a bug or a syntax error, and the behaviour goes back to at least Python 1.5 if not older. List.reverse returns a reference to the method object itself. List.reverse() *calls* the method. This is standard behaviour in Python, all method

[issue34645] math and numpy yield different results (nan)

2018-09-12 Thread Steven D'Aprano
Steven D'Aprano added the comment: Your code gives runtime warnings of invalid values. You should fix that. If your values are invalid, there's probably a bug in your code. RuntimeWarning: invalid value encountered in double_scalars Your code is also very complex. You ought to si

[issue34645] math and numpy yield different results (nan)

2018-09-12 Thread Steven D'Aprano
Steven D'Aprano added the comment: Oops, sorry, I mistyped. I said: So there's a problem. You're trying to raise a negative number to a positive value I meant to say a *fractional* value. Sorry for the confusion. -- ___

[issue34645] math and numpy yield different results (nan)

2018-09-12 Thread Steven D'Aprano
Steven D'Aprano added the comment: > Well, the thing is that i pass two (apparent) identical values into the same > function, Even if they have the same *numeric* value, they aren't the same kind of value, and they aren't the same function. One is and the othe

[issue34709] Suggestion: make getuser.getpass() also look at SUDO_USER environment variable

2018-09-27 Thread Steven D'Aprano
Steven D'Aprano added the comment: Versions 3.7 and below are all in feature-freeze, so this change could only apply to 3.8 and above. I don't know if this feature is desirable or not. If it is (sometimes?) desirable, my guess is that it would be undesirable to use SUDO_USER *u

[issue34763] Python lacks 0x4E17

2018-09-27 Thread Steven D'Aprano
Change by Steven D'Aprano : -- nosy: +steven.daprano ___ Python tracker <https://bugs.python.org/issue34763> ___ ___ Python-bugs-list mailing list Unsubscr

[issue34835] Multiprocessing module update fails with pip3

2018-09-28 Thread Steven D'Aprano
Steven D'Aprano added the comment: ``pip3 search multiprocessing`` says: multiprocessing (2.6.2.1)- Backport of the multiprocessing package to Python 2.4 and 2.5 so you are trying to install a Python 2.4/2.5 package into Python 3.7, which naturally cannot work. In Pytho

[issue34850] Emit a syntax warning for "is" with a literal

2018-09-30 Thread Steven D'Aprano
Steven D'Aprano added the comment: I like this solution of a syntax warning for `is ` and I agree that `== None` should not be a warning. (And for what its worth, I strongly disagree with making `is` a hybrid sometimes-check-identity-sometimes-check-equality operator.) --

[issue34850] Emit a syntax warning for "is" with a literal

2018-10-01 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Sun, Sep 30, 2018 at 10:24:41PM +, Nathaniel Smith wrote: > Would it make sense to implement a "chaos" mode (that e.g. testing > tools could enable unconditionally), that disables the small integer > and small string caches?

[issue34867] Add mode to disable small integer and interned string caches

2018-10-01 Thread Steven D'Aprano
New submission from Steven D'Aprano : Split off from #34850 by Guido's request. To help catch incorrect use of `is` when `==` is intended, perhaps we should add an interpreter mode that disables the caches for small ints and interned strings. Nathaniel called it "chaos mo

[issue34850] Emit a syntax warning for "is" with a literal

2018-10-01 Thread Steven D'Aprano
Steven D'Aprano added the comment: Please move the "chaos" discussion to #34867 -- ___ Python tracker <https://bugs.python.org/issue34850> ___ ___

[issue34880] About the "assert" bytecode

2018-10-03 Thread Steven D'Aprano
Steven D'Aprano added the comment: If I have understood you correctly, you are asking whether it is expected behaviour for assert to use the global AssertionError instead of the built-in AssertionError. I don't see why it shouldn't. In any case, that behaviour goes back to

[issue34880] About the "assert" bytecode

2018-10-03 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Wed, Oct 03, 2018 at 09:49:06AM +, thautwarm wrote: > Steven, this problem is quite interesting because it just allows users > to cause fatal errors without any invalid operations. How is that different from every other case of shadowin

[issue34880] About the "assert" bytecode

2018-10-03 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Wed, Oct 03, 2018 at 01:56:00PM +, Eric V. Smith wrote: > I think this is a bug that should be fixed. Supporting this position, shadowing other exceptions doesn't change the exception generated by the interpreter: py> TypeError =

[issue34880] About the "assert" bytecode

2018-10-03 Thread Steven D'Aprano
Steven D'Aprano added the comment: > And, I think a broader discussion on python-dev might be useful, too, in > order to get more opinions. Done: https://mail.python.org/pipermail/python-dev/2018-October/155410.html Changing the status to Pending until we have more clarity on w

[issue34907] calculation not working properly

2018-10-05 Thread Steven D'Aprano
Steven D'Aprano added the comment: For future reference, please don't post unnecessary screen shots and images. Code is text, please copy and paste it as text, not as pixels. Images make it difficult or impossible for the blind and visually impaired to contribute. -

[issue22232] str.splitlines splitting on non-\r\n characters

2018-10-07 Thread Steven D'Aprano
Steven D'Aprano added the comment: I don't like the idea of adding a second bool parameter to splitlines. Guido has a rough rule of thumb (which I agree with) of "no constant bool parameters". If people will typically call a function with some sort of "mode"

[issue33084] Computing median, median_high an median_low in statistics library

2018-10-07 Thread Steven D'Aprano
Steven D'Aprano added the comment: I want to revisit this for 3.8. I agree that the current implementation-dependent behaviour when there are NANs in the data is troublesome. But I don't think that there is a single right answer. I also agree with Mark that if we change median, w

[issue28716] Fractions instantiation revisited

2018-10-07 Thread Steven D'Aprano
Change by Steven D'Aprano : -- nosy: +steven.daprano ___ Python tracker <https://bugs.python.org/issue28716> ___ ___ Python-bugs-list mailing list Unsubscr

[issue34928] string method .upper() converts 'ß' to 'SS' instead of 'ẞ'

2018-10-08 Thread Steven D'Aprano
Steven D'Aprano added the comment: We match the Unicode specification, not arbitrary language rules. (Austrian and Swiss German are, I believe, phasing out ß altogether, and haven't added an uppercase variant.) Until the Unicode consortium change their case conversion rules, i

[issue34079] Multiprocessing module fails to build on Solaris 11.3

2018-10-09 Thread Steven Packard
Steven Packard added the comment: I don't think you can blindly change that value of that definition. It will likely break the compilation of the module using Solaris Sun Studio while fixing compilation with gcc. The attached patch should do the correct thing in the presence of e

[issue34948] Document __warningregister__

2018-10-09 Thread Steven D'Aprano
New submission from Steven D'Aprano : The warnings module makes use of a per-module global ``__warningregister__`` which is briefly mentioned in the docs but not documented. https://docs.python.org/3/library/warnings.html#warnings.warn_explicit Given that it is part of the warn_explici

[issue34948] Document __warningregister__

2018-10-10 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Wed, Oct 10, 2018 at 05:11:01AM +, Serhiy Storchaka wrote: > I don't think that it is necessary to state its format. It is an > opaque dictionary, and its format is an implementation detail. There is at least one use-case for wanti

[issue34991] variable type list [] referential integrity data loss

2018-10-15 Thread Steven D'Aprano
Steven D'Aprano added the comment: I don't know what you mean by "referential integrity data loss". I have absolutely no idea how to interpret the wall of output you have provided. If there is a bug here, how do you know it is a language bug rather than a bug in your

[issue35010] sort by partially reversed key tuple

2018-10-17 Thread Steven D'Aprano
Steven D'Aprano added the comment: Since sort is guaranteed to be stable, can't you sort in two runs? py> values = ['bc', 'da', 'ba', 'abx', 'ac', 'ce', 'dc', 'ca', 'aby'] py> values.so

[issue35010] sort by partially reversed key tuple

2018-10-17 Thread Steven D'Aprano
Steven D'Aprano added the comment: The ``sorted`` docs links to the Sorting HOWTO, the ``list.sort`` docs should do the same. https://docs.python.org/3/library/functions.html#sorted https://docs.python.org/3/library/stdtypes.html#list

[issue35010] sort by partially reversed key tuple

2018-10-17 Thread Steven D'Aprano
Steven D'Aprano added the comment: > And you are free to use whatever sorting algorithms in its implementation for > this kind of task. That's very kind of you *wink* At this point, I don't think there's much more point to discussing this further until Tim Peters

[issue35069] Unexecuted import in function causes UnboundLocalError

2018-10-25 Thread Steven D'Aprano
Steven D'Aprano added the comment: This is expected behaviour: import is a form of assignment. "import logging", like "logging = 1", tells the compiler to treat logging as a local variable (unless you declare logging as global). As the exception says, you are try

[issue35069] Unexecuted import in function causes UnboundLocalError

2018-10-25 Thread Steven D'Aprano
Steven D'Aprano added the comment: Stéphane, I'm curious why you asked for a pastebin when James already provided the code right here in the tracker? (Your email even included a copy of that code.) Why split the information into anoth

[issue35069] Unexecuted import in function causes UnboundLocalError

2018-10-25 Thread Steven D'Aprano
Steven D'Aprano added the comment: Yes, that's exactly right. That's how local variables work in Python: x = 999 # global x def demo(): if False: x = 1 x # local x has no value does the same thing. This is standard, documented behaviour, regardless of which kin

[issue35085] FileNotFoundError: [Errno 2] No such file or directory:

2018-10-27 Thread Steven D'Aprano
Steven D'Aprano added the comment: What do you mean, a crash report? You get a traceback telling you the problem: the file is missing. What behaviour did you expect if you try to decode a non-existent file? Perhaps you meant to write: python3 -m base64 -t "12s345a2" I don&

[issue35085] FileNotFoundError: [Errno 2] No such file or directory:

2018-10-28 Thread Steven D'Aprano
Change by Steven D'Aprano : -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.pyth

[issue35098] Deleting __new__ does not restore previous behavior

2018-10-28 Thread Steven D'Aprano
Steven D'Aprano added the comment: I think the real WTF here is that you can write to arbitrary dunder attributes even if they aren't listed in __slots__. py> Color.__NOBODY_expects_the_Spanish_Inquisition__ = "What?" py> Color.__NOBODY_expects_the_Spanish_Inquisiti

[issue35098] Deleting __new__ does not restore previous behavior

2018-10-28 Thread Steven D'Aprano
Steven D'Aprano added the comment: > Its quite valid to assign to __new__ to replace the behavior of how an > instance is created. Of course it is, and I never argued otherwise. > Finally as for `Color.__x__` assignment, this has nothing to do with > `__slots__` as i

[issue35129] Different behaviour comparing versions (distutils.version.LooseVersion) between python2.7 and python3.x

2018-10-31 Thread Steven D'Aprano
Steven D'Aprano added the comment: There is no need to split the relevant code into a third-party website, especially when it is so small and can be included in-line here. Python 2.7: py> import distutils.version py> distutils.version.LooseVersion('7') > distutils.

[issue35123] Add style guide for sentinel usage

2018-10-31 Thread Steven D'Aprano
Steven D'Aprano added the comment: I was not aware that there currently were arguments about the use of sentinels in future code. I feel that you are being excessively prescriptive here: "we should nip it in the bud" is good advice for gardening, but for programming it just r

[issue35124] Add style guide for unit tests

2018-10-31 Thread Steven D'Aprano
Steven D'Aprano added the comment: I think this is being excessively prescriptive and solving a problem that isn't a problem. But perhaps if you start by proposing a concrete style guide, I can judge better. -- nosy: +steven.daprano

[issue35146] Bad Regular Expression Broke re.findall()

2018-11-02 Thread Steven D'Aprano
Steven D'Aprano added the comment: This is not a bug in Python, it is an invalid (broken) regular expression. There is nothing that the interpreter or the regular expression engine can do, because you are telling it to do something that makes no sense. What do you expect findall to fin

[issue35165] Possible wrong method name in attribute references doc

2018-11-04 Thread Steven D'Aprano
Steven D'Aprano added the comment: https://docs.python.org/3/reference/expressions.html#attribute-references __getattr__ is the correct method to override in most (but not all) cases. I don't think we should encourage people to override __getattribute__ as the fi

[issue35166] BUILD_MAP_UNPACK doesn't function as expected for dict subclasses

2018-11-04 Thread Steven D'Aprano
Steven D'Aprano added the comment: You say it doesn't work as expected, but you don't say what you expect or why. (Don't make me guess what you mean -- explicit is better than implicit.) When I try your subclass in 3.6, I get an unexpected TypeError: py> class Dict(

[issue35166] BUILD_MAP_UNPACK doesn't function as expected for dict subclasses

2018-11-04 Thread Steven D'Aprano
Steven D'Aprano added the comment: How weird... after restarting the interpreter, I can't reproduce that TypeError. I get the AssertionError Serhiy showed. -- ___ Python tracker <https://bugs.python.o

[issue35176] for loop range bug

2018-11-06 Thread Steven D'Aprano
Steven D'Aprano added the comment: This is not a bug, this is standard behaviour, working as designed. 'a' is not a copy of the list 'x', 'a' is another name for the same list as 'x'. Any in-place modifications you make to 'a' ha

[issue35200] Range repr could be better

2018-11-09 Thread Steven D'Aprano
Steven D'Aprano added the comment: Not everyone knows the '...' convention. At least according to Google's predictive search, if I type "what does three dots" I get common searches such as "what does three dots mean at the end of a sentence" and simila

[issue35200] Range repr could be better

2018-11-09 Thread Steven D'Aprano
Steven D'Aprano added the comment: With the proposed design, any two empty range objects have the same repr: repr(range(0)) == repr(range(2, 2)) == repr(range(1, 5, -1)) etc. Between this loss of information, and the loss of round-tripping through eval, I'm against this proposa

[issue35200] Range repr could be better

2018-11-11 Thread Steven D'Aprano
Steven D'Aprano added the comment: > I've never seen any student try `str(range(10))` in the repl I never suggested that students would try calling str() directly. That would be silly. They would use print(), as I'm sure many of them are already doing. After 20+ years

[issue35221] Enhance venv activate commands readability

2018-11-12 Thread Steven D'Aprano
Steven D'Aprano added the comment: https://docs.python.org/3/library/venv.html > my students are often confused by it, sometimes they copy the angle brackets, > sometime even the prompt. Learning to recognise placeholders and the prompt is an essential part of learning to code,

[issue35224] PEP 572: Assignment Expressions

2018-11-13 Thread Steven D'Aprano
Change by Steven D'Aprano : -- nosy: +steven.daprano ___ Python tracker <https://bugs.python.org/issue35224> ___ ___ Python-bugs-list mailing list Unsubscr

[issue35245] list comprehension for flattened or nested list differ too much

2018-11-14 Thread Steven D'Aprano
Steven D'Aprano added the comment: > l2 = [str(leaf) for leaf in tree for tree in forest] Expanded to nested loops, that becomes: l2 = [] for leaf in tree: for tree in forest: l2.append(str(leaf)) which of course gives a NameError, because you are trying to iterate over

[issue35256] The Console of Python 3.7.0.

2018-11-15 Thread Steven D'Aprano
Steven D'Aprano added the comment: I don't understand what you think is the bug. You keep repeatedly appending 'z' to the same list. Why are you surprised that it appends 'z' more than once? If you don't want to append it twice, don't call the

[issue35200] Make the half-open range behaviour easier to teach

2018-11-18 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Sun, Nov 18, 2018 at 09:43:02PM +, Julien Palard wrote: > My first though went to giving something really simple like: > > >>> print(range(10)) > 1, 2, ..., 8, 9 -1 Surely that would be your *second* thought, since yo

[issue35274] Running print("\x98") then freeze in Interpreter

2018-11-19 Thread Steven D'Aprano
Steven D'Aprano added the comment: I'm afraid I can't reproduce that in Python 3.5.2 or 3.6.4. Can you try this? from time import time print(time(), '\x98', time()); print(time()) and copy and paste the results. What terminal/console are you using? If you chan

[issue35200] Make the half-open range behaviour easier to teach

2018-11-19 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Sun, Nov 18, 2018 at 10:27:11PM +, Julien Palard wrote: > > Julien Palard added the comment: > > If I understand correctly, you'd like str(range(10)) to return " [1, 2, ..., 8, 9]>"? Exactly the same as you sugg

[issue18502] CDLL does not use same paths as util.find_library

2013-07-18 Thread Steven Johnson
New submission from Steven Johnson: CDLL does not use the same paths as find_library and thus you can *find* a library, but you can't necessarily use it. In my case, I had SDL2 in /usr/local/lib. find_library correctly gets the name, but does not return the path. CDLL apparently doe

[issue18502] CDLL does not use same paths as util.find_library

2013-07-22 Thread Steven Johnson
Steven Johnson added the comment: Should the docs then be changed for find_library to inform that "It is not guaranteed that a found library can be opened" (at least for linux)? Or would a feature request for full paths from find_library for linux be more appropriate? It seems hac

[issue18568] Support \e escape code in strings

2013-07-26 Thread Steven D'Aprano
New submission from Steven D'Aprano: I'm adding this so there is a record in the bug tracker for posterity. No action is needed except to close it as a "Won't Fix". As per this discussion here: http://mail.python.org/pipermail/python-ideas/2013-June/021318.html using

[issue18568] Support \e escape code in strings

2013-07-26 Thread Steven D'Aprano
Changes by Steven D'Aprano : -- resolution: -> rejected status: open -> closed ___ Python tracker <http://bugs.python.org/issue18568> ___ ___ Python-

[issue18572] Remove redundant note about surrogates in string escape doc

2013-07-27 Thread Steven D'Aprano
New submission from Steven D'Aprano: The documentation for string escapes suggests that \u escapes can be used to generate characters in the Supplementary Multilingual Planes by using surrogate pairs: "Individual code units which form parts of a surrogate pair can be encoded

[issue18572] Remove redundant note about surrogates in string escape doc

2013-07-29 Thread Steven D'Aprano
Steven D'Aprano added the comment: On 29/07/13 22:27, R. David Murray wrote: >>>> '\uD80C\uDC80' == '\U00013080' > False Are you running a wide build? In a narrow build, it returns True. -- ___ Python tra

[issue5845] rlcompleter should be enabled automatically

2013-07-31 Thread Steven D'Aprano
Steven D'Aprano added the comment: On 31/07/13 17:14, Larry Hastings wrote: > IMO the optimal solution is that tab preceded by only whitespace indents, and > tab preceded by any non-whitespace character attempts to complete. Can we > goad readline into behaving this wa

[issue18606] Add statistics module to standard library

2013-07-31 Thread Steven D'Aprano
New submission from Steven D'Aprano: I proposed adding a statistics module to the standard library some time ago, and received some encouragement: http://mail.python.org/pipermail/python-ideas/2011-September/011524.html Real life intervened, plus a bad case of over-engineering, but ove

[issue18614] Enhanced \N{} escapes for Unicode strings

2013-08-01 Thread Steven D'Aprano
New submission from Steven D'Aprano: As per the discussion here: http://mail.python.org/pipermail/python-ideas/2013-July/022419.html \N{} escapes should support the Unicode code point notation U+ (where there are four, five or six hex digits after the U+). E.g. '\N{U+03

[issue18585] Add a text truncation function

2013-08-02 Thread Steven D'Aprano
Steven D'Aprano added the comment: A function like this often gets called to truncate lots of lines. Unfortunately for many use-cases, the part truncated is the most significant part of the line. E.g.: Scanning file: /home/fred/documents/datafil... /home/fred/documents/datafil... /home

[issue18585] Add a text truncation function

2013-08-02 Thread Steven D'Aprano
Steven D'Aprano added the comment: Bike-shedding here... why "(...)"? Is it common to use round brackets for this purpose? In English-speaking countries, it is usual to use square brackets for editorial comments, including ellipsis "[...]". Either way, if you wanted

[issue18606] Add statistics module to standard library

2013-08-03 Thread Steven D'Aprano
Steven D'Aprano added the comment: On 03/08/13 13:02, Alexander Belopolsky wrote: > > Alexander Belopolsky added the comment: > > Is there a reason why there is no "review" link? Could it be because the > file is uploaded as is rather than as a patch? I cann

[issue18606] Add statistics module to standard library

2013-08-03 Thread Steven D'Aprano
Steven D'Aprano added the comment: On 04/08/13 05:31, Alexander Belopolsky wrote: > > Alexander Belopolsky added the comment: > > Here is the use-case that was presented to support adding additional > operations on timedelta objects: > > """ > I'

[issue18606] Add statistics module to standard library

2013-08-05 Thread Steven D'Aprano
Steven D'Aprano added the comment: On 03/08/13 13:22, Alexander Belopolsky wrote: > > Alexander Belopolsky added the comment: > > The implementation of median and mode families of functions as classes is > clever, So long as it is not too clever. > but I am not su

[issue18606] Add statistics module to standard library

2013-08-05 Thread Steven D'Aprano
Steven D'Aprano added the comment: On 06/08/13 03:08, Mark Dickinson wrote: > > I too find the use of a class that'll never be instantiated peculiar. I'll accept "unusual", but not "peculiar". It's an obvious extension to classes being first

[issue11619] On Windows, don't encode filenames in the import machinery

2013-08-07 Thread Steven Velez
Steven Velez added the comment: This may be a small use case, but a use case none-the less. In my situation, I am distributing a frozen python package and it runs under the users home directory. If the user's name has international characters, this will fail. I expect we will have si

[issue18606] Add statistics module to standard library

2013-08-09 Thread Steven D'Aprano
Steven D'Aprano added the comment: On 31/07/13 20:23, Antoine Pitrou added the comment: > > I suppose you should write a PEP for the module inclusion proposal Done. http://www.python.org/dev/peps/pep-0450/ I hope to have an updated reference implementation, plus unittests, up late

[issue18606] Add statistics module to standard library

2013-08-12 Thread Steven D'Aprano
Steven D'Aprano added the comment: On 09/08/13 21:49, Oscar Benjamin wrote: > I think that the argument `m` to variance, pvariance, stdev and pstdev > should be renamed to `mu` for pvariance/pstdev and `xbar` for > variance/stdev. The doc-strings should carefully distinguish that

[issue18606] Add statistics module to standard library

2013-08-12 Thread Steven D'Aprano
Steven D'Aprano added the comment: On 12/08/13 19:21, Mark Dickinson wrote: > About the implementation of sum: it's worth noting that the algorithm you're > using for floats depends on correct rounding of addition and subtraction, and > that that's not guaranteed.

[issue18606] Add statistics module to standard library

2013-08-13 Thread Steven D'Aprano
Steven D'Aprano added the comment: Attached is a patch containing the statistics reference implementation, after considering feedback given here and on python-ideas, and tests. -- keywords: +patch Added file: http://bugs.python.org/file31286/statistics.

[issue18749] [issue 18606] Re: Add statistics module to standard library

2013-08-15 Thread Steven D'Aprano
New submission from Steven D'Aprano: I hope I'm doing the right thing by replying in-line. This is my first code review, please let me know if I'm doing something wrong. By the way, the email hasn't gone to the tracker again. Is that a bug in the tracker? I've take

[issue18606] Add statistics module to standard library

2013-08-16 Thread Steven D'Aprano
Steven D'Aprano added the comment: To anyone waiting for me to respond to rietveld reviews, I'm trying, I really am, but I keep getting a django traceback. This seems to have been reported before, three months ago: http://psf.upfronthosting.co.za/roundup/met

[issue18606] Add statistics module to standard library

2013-08-18 Thread Steven D'Aprano
Steven D'Aprano added the comment: Since I can't respond to the reviews, here's a revised patch. Summary of major changes: - median.* functions are now median_* - mode now only returns a single value - better integrate tests with Python regression suite - cleanup test

[issue18606] Add statistics module to standard library

2013-08-18 Thread Steven D'Aprano
Steven D'Aprano added the comment: On 15/08/13 22:58, ezio.melo...@gmail.com wrote: > http://bugs.python.org/review/18606/diff/8927/Lib/statistics.py#newcode277 > Lib/statistics.py:277: assert isinstance(x, float) and > isinstance(partials, list) > Is this a good idea? I thin

[issue18606] Add statistics module to standard library

2013-08-18 Thread Steven D'Aprano
Steven D'Aprano added the comment: Merged two test suites into one, and PEP-ified the test names testSpam -> test_spam. -- Added file: http://bugs.python.org/file31366/test_statistics.patch ___ Python tracker <http://bugs.python.org

[issue18606] Add statistics module to standard library

2013-08-18 Thread Steven D'Aprano
Steven D'Aprano added the comment: Patch file for the stats module alone, without the tests. -- Added file: http://bugs.python.org/file31367/statistics.patch ___ Python tracker <http://bugs.python.org/is

[issue18606] Add statistics module to standard library

2013-08-19 Thread Steven D'Aprano
Steven D'Aprano added the comment: On 19/08/13 23:15, Oscar Benjamin wrote: > So with the current implementation I can do: > >>>> from decimal import Decimal as D, localcontext, Context, ROUND_DOWN >>>> data = [D("0.1375"), D("0.2108"), D

[issue18606] Add statistics module to standard library

2013-08-21 Thread Steven D'Aprano
Steven D'Aprano added the comment: On 20/08/13 22:43, Mark Dickinson wrote: > I agree with Oscar about sum for decimal.Decimal. The *ideal* sum for > Decimal instances would return the correctly rounded result (i.e., the exact > result, rounded to the current context just

[issue18606] Add statistics module to standard library

2013-08-26 Thread Steven D'Aprano
Steven D'Aprano added the comment: I have changed the algorithm for statistics.sum to use long integer summation of numerator/denominator pairs. This removes the concerns Mark raised about the float addition requiring correct rounding. Unless I've missed something, this now

[issue18841] math.isfinite fails with Decimal sNAN

2013-08-26 Thread Steven D'Aprano
New submission from Steven D'Aprano: math.isfinite currently raises ValueError when given a Decimal sNAN (signalling NAN). I've run into a situation where I'm calling isfinite() on a numeric value which may be a Decimal sNAN, and it would be nice if it returned False. On the

[issue18842] Add float.is_finite is_nan is_infinite to match Decimal methods

2013-08-26 Thread Steven D'Aprano
New submission from Steven D'Aprano: On issue 15544 Mark Dickinson suggested adding methods to float to match methods on Decimal, giving type-agnostic ways of testing real numbers that don't rely on converting to float. I don't see any sign that Mark raised a feature request

[issue18921] In imaplib, cached capabilities may be out of date after login

2013-09-04 Thread Steven Murdoch
New submission from Steven Murdoch: When an IMAP server is behind a proxy, the proxy's capabilities may differ from that of the actual IMAP server. However, in Python imaplib, the client will ignore any updates to available capabilities in the response to the LOGIN command (see rf

[issue13789] _tkinter does not build on Windows 7

2012-04-25 Thread Steven Winfield
Steven Winfield added the comment: The tk sources (at least the 8.5.11 version I'm looking at now) have some X11 headers that can be used by the windows build in the "xlib" directory. -- nosy: +steven.winfield ___ Python

[issue15248] In "TypeError: 'tuple' object is not callable", explain that a comma may be missing

2012-07-05 Thread Steven D'Aprano
Steven D'Aprano added the comment: I think this suggested enhancement is unreasonable and of limited usefulness, and even if it were useful, too specialised to bother with. The obvious message is badly misleading. When I read this: TypeError: 'tuple' object is not callable,

[issue13922] argparse handling multiple "--" in args improperly

2012-07-21 Thread Steven Bethard
Steven Bethard added the comment: This patch looks like the right fix to me. The tests look good too. -- ___ Python tracker <http://bugs.python.org/issue13

[issue14365] argparse: subparsers, argument abbreviations and ambiguous option

2012-07-21 Thread Steven Bethard
Steven Bethard added the comment: I think the real fix needs to search recursively though all subparsers. Here's a first draft of a patch that does this. I believe your sample code works after this patch. I don't have the time to turn your bug report into proper test (and add a tes

[issue14391] misc TYPO in argparse.Action docstring

2012-07-21 Thread Steven Bethard
Steven Bethard added the comment: The patch supplied was in reverse, but the bug report was correct. You can't pass "type=string" since there's no string callable, only a str callable. The docstring is confusing because the quotes make it looks like we mean the string &#x

[issue14392] type=bool doesn't raise error in argparse.Action

2012-07-21 Thread Steven Bethard
Steven Bethard added the comment: I can't find anywhere in the documentation where type=bool, type=unicode or type=long are disallowed. They shouldn't be disallowed. If you want to pass type=bool, argparse should not stop you. And it currently doesn't: >>> parser =

[issue14449] argparse optional arguments should follow getopt_long(3)

2012-07-21 Thread Steven Bethard
Steven Bethard added the comment: I don't think this is going to change. It's basically a consequence of having a unified handling of nargs='?', nargs='*', nargs='+', etc. These will all consume as many arguments as they can, and argparse doesn&

[issue14504] Suggestion to improve argparse's help messages for "store_const"

2012-07-21 Thread Steven Bethard
Steven Bethard added the comment: Special casing the formatting of 'store_const' makes me nervous because formatting is already complicated and it doesn't know anything about action types. But feel free to propose a patch! In the meantime: - propagate the default to all t

[issue13824] argparse.FileType opens a file and never closes it

2012-07-21 Thread Steven Bethard
Steven Bethard added the comment: So I generally agree that FileType is not what you want for anything but quick scripts that can afford to either leave a file open or to close stdin and/or stdout. However, quick scripts are an important use case for argparse, so I don't think we shoul

[issue12776] argparse: type conversion function should be called only once

2012-07-21 Thread Steven Bethard
Steven Bethard added the comment: The patch looks good to me. I've updated it for trunk and to include Mike Meyer's additional test. All argparse tests pass. Anyone who's able to commit and backport, please do. (I should be able to commit myself, but it's now been too

[issue12353] argparse cannot handle empty arguments

2012-07-21 Thread Steven Bethard
Steven Bethard added the comment: Yes, the original patch looks fine to me. I applied and tested it, and it works as expected. Please go ahead and apply. -- ___ Python tracker <http://bugs.python.org/issue12

<    9   10   11   12   13   14   15   16   17   18   >