[issue20499] Rounding errors with statistics.variance

2014-02-07 Thread Wolfgang Maier
Wolfgang Maier added the comment: Ok, I finally managed to get the test suite right for this, so here is the patch diff for everything. I made a few final changes to the module itself (mostly to please the test suite), so I'll edited the complete code as well. -- keywords: +

[issue20499] Rounding errors with statistics.variance

2014-02-07 Thread Wolfgang Maier
Changes by Wolfgang Maier : Added file: http://bugs.python.org/file33959/statistics.py ___ Python tracker <http://bugs.python.org/issue20499> ___ ___ Python-bugs-list m

[issue20499] Rounding errors with statistics.variance

2014-02-07 Thread Wolfgang Maier
Wolfgang Maier added the comment: In principle, your approach using itertools.groupby, the existing _sum, your decimalsum, and my _ExactRatio class could be combined. You could call decimalsum for Decimal and subclasses, the current _sum for everything else. _sum would return an _ExactRatio

[issue20561] Decimal handling error in statistics module

2014-02-08 Thread Wolfgang Maier
New submission from Wolfgang Maier: Can this still be fixed in 3.4 ?? I came across this bug in the statistics module today: >>> import statistics >>> data = [Decimal('1e4')] >>> statistics.mean(data) Traceback (most recent call last): File "",

[issue20561] Decimal handling error in statistics module

2014-02-08 Thread Wolfgang Maier
Wolfgang Maier added the comment: #if type(den) != int: #print (d, sign, digits, exp, num, den) was inserted by me of course for debugging this. Forgot to take it out again. -- ___ Python tracker <http://bugs.python.org/issue20

[issue20561] Decimal handling error in statistics module

2014-02-08 Thread Wolfgang Maier
Changes by Wolfgang Maier : -- nosy: +ncoghlan ___ Python tracker <http://bugs.python.org/issue20561> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue20536] statistics._decimal_to_ratio() produces non-integer ratio

2014-02-08 Thread Wolfgang Maier
Wolfgang Maier added the comment: Steven, I think if exp >= 0: return int(x), 1 would have been a better patch, but yours is certainly working, just slower I guess. -- nosy: +wolma ___ Python tracker <http://bugs.python.org/issu

[issue20499] Rounding errors with statistics.variance

2014-02-08 Thread Wolfgang Maier
Wolfgang Maier added the comment: I worked out a slightly speedier version of decimal_to_ratio today (Stefan: that's when I duplicated your bug report): from decimal import Context def _decimal_to_ratio (x): _, digits, exp = x.as_tuple() if exp in _ExactRatio.decimal_infinite:

[issue20499] Rounding errors with statistics.variance

2014-02-08 Thread Wolfgang Maier
Wolfgang Maier added the comment: oops, > if exp in _ExactRatio.decimal_infinite: # INF, NAN, sNAN should read if exp in ('F', 'n', 'N'): # INF, NAN, sNAN of course. What I pasted comes from a micro-optimization I tried, bu

[issue27761] Private _nth_root function loses accuracy

2016-11-23 Thread Wolfgang Maier
Changes by Wolfgang Maier : -- nosy: +wolma ___ Python tracker <http://bugs.python.org/issue27761> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue22298] Lib/warnings.py _show_warning does not protect against being called with a file like object which is closed

2016-11-23 Thread Wolfgang Maier
Wolfgang Maier added the comment: Issue23016 fixed the "AttributeError: 'NoneType' object has no attribute 'write'" problem when sys.stderr is None. With that it's now possible and good practice to set sys.stderr = None when closing it, just as Antoine sug

[issue10379] locale.format() input regression

2016-11-23 Thread Wolfgang Maier
Changes by Wolfgang Maier : -- nosy: +wolma ___ Python tracker <http://bugs.python.org/issue10379> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue15533] subprocess.Popen(cwd) documentation

2016-11-24 Thread Wolfgang Maier
Wolfgang Maier added the comment: Ping. This still isn't fixed several years later, i.e., the documentation still describes the POSIX, but not the Windows behavior. See also issue20927, which reports this as a bug. -- nosy: +wolma versions: +Python 3.5, Python 3.6, Python 3.7 -P

[issue15533] subprocess.Popen(cwd) documentation

2016-11-25 Thread Wolfgang Maier
Wolfgang Maier added the comment: Before I forget again what I've gathered yesterday about this issue, here's a summary of the problem: When the the first element of args or the executable argument of subprocess.Popen does not specify an absolute path, the way the executable gets

[issue22298] Lib/warnings.py _show_warning does not protect against being called with a file like object which is closed

2016-11-25 Thread Wolfgang Maier
Wolfgang Maier added the comment: Hi Julius, I guess it's a question of control and responsibilities. If you write a program that may issue warnings under some conditions, that program may, for example, be used with stderr redirected to a file. Now it is possible that file gets removed

[issue22298] Lib/warnings.py _show_warning does not protect against being called with a file like object which is closed

2016-11-25 Thread Wolfgang Maier
Wolfgang Maier added the comment: Ah, I just found Issue607668, which discusses the changeset 2e7fe55c0e11 that introduced IOError suppression. The actual use case at the time was different and I have no idea whether it would still be a problem today

[issue28801] configparser: before_get() method of class Interpolation has positional 'parser' parameter that is not used.

2016-11-25 Thread Wolfgang Maier
Wolfgang Maier added the comment: Ah, that's kind of confusing at first! the 'self' in the method calls (like on line 796) refers to the ConfigParser instance and will be bound to the parser parameter. The first parameter, the 'self' in the interpolation method defin

[issue28801] configparser: before_get() method of class Interpolation has positional 'parser' parameter that is not used.

2016-11-25 Thread Wolfgang Maier
Wolfgang Maier added the comment: > Ah. Something like self._interpolation.before_get(self, section, option, > value, d) could be better written as > self._interpolation.before_get(parser=self, ...) Yep, that's roughly what I was trying to explain. > I still don't g

[issue9938] Documentation for argparse interactive use

2016-11-28 Thread Wolfgang Maier
Changes by Wolfgang Maier : -- nosy: +wolma ___ Python tracker <http://bugs.python.org/issue9938> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue14845] list() != []

2016-11-28 Thread Wolfgang Maier
Wolfgang Maier added the comment: Isn't the difference between generator expressions and comprehensions what's dealt with by PEP479? So it seems this issue is outdated enough to deserve being closed? -- nosy: +wolma ___ Python trac

[issue14845] list() != []

2016-11-29 Thread Wolfgang Maier
Wolfgang Maier added the comment: Mark, PEP479 is not fully in effect in 3.6 yet. 3.7 will raise the RuntimeError, but 3.6 still only gives a DeprecationWarning. -- ___ Python tracker <http://bugs.python.org/issue14

[issue14845] list() != []

2016-11-29 Thread Wolfgang Maier
Wolfgang Maier added the comment: running with "-W always": >>> def five(x): ... for _ in range(5): ... yield x ... >>> F = five('x') >>> [next(F) for _ in range(10)] Traceback (most recent call last): File "", line 1,

[issue15533] subprocess.Popen(cwd) documentation

2016-11-29 Thread Wolfgang Maier
Wolfgang Maier added the comment: Just found issue15451, which reports a similar inconsistency between Windows and POSIX for 'PATH' provided through the Popen env parameter as for cwd. It seems that, on POSIX-platforms, the PATH environment variable passed through env affects the

[issue18971] calendar

2016-12-01 Thread Wolfgang Maier
Changes by Wolfgang Maier : -- title: Use argparse in the profile/cProfile modules -> calendar ___ Python tracker <http://bugs.python.org/issue18971> ___ ___ Py

[issue18971] Use argparse in the profile/cProfile modules

2016-12-01 Thread Wolfgang Maier
Wolfgang Maier added the comment: oops, typing in wrong window. Very sorry. -- nosy: +wolma title: calendar -> Use argparse in the profile/cProfile modules ___ Python tracker <http://bugs.python.org/issu

[issue28859] os.path.mount sometimes raises FileNotFoundError on Windows

2016-12-02 Thread Wolfgang Maier
Changes by Wolfgang Maier : -- nosy: +wolma ___ Python tracker <http://bugs.python.org/issue28859> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue28956] return minimum of modes for a multimodal distribution instead of raising a StatisticsError

2016-12-13 Thread Wolfgang Maier
Wolfgang Maier added the comment: What's the justification for this proposed change? Isn't it better to report the fact that there isn't an unambiguous result instead of returning a rather arbitrary one? -- nosy: +steven.daprano, wolma versions: +Python

[issue18378] locale.getdefaultlocale() fails on Mac OS X with default language set to English

2017-01-12 Thread Wolfgang Maier
Wolfgang Maier added the comment: To me this issue seems quite related to PEP 538. Maybe the LC_CTYPE coercion proposed in the PEP could be extended to cover the case of LC_CTYPE=UTF-8? -- nosy: +ncoghlan versions: +Python 3.7 ___ Python tracker

[issue18378] locale.getdefaultlocale() fails on Mac OS X with default language set to English

2017-01-12 Thread Wolfgang Maier
Wolfgang Maier added the comment: I think PEP 538 extended to the UTF-8 locale *would* help here. Specifically, it would coerce only LC_CTYPE to en_US.UTF-8 (unless OS X has C.UTF-8), which I guess is good enough for the purpose here. I do agree that it is not the kind of problem that PEP 538

[issue29414] Change 'the for statement is such an iterator' in Tutorial

2017-02-28 Thread Wolfgang Maier
Wolfgang Maier added the comment: I studied the github PR and thought about it carefully, and that made me come to believe that the chapter deserves a larger rewrite not just of one section, but of several. I'm attaching my proposed change as a "classical" patch here for disc

[issue29414] Change 'the for statement is such an iterator' in Tutorial

2017-02-28 Thread Wolfgang Maier
Wolfgang Maier added the comment: > [...] I prefere the chapter as it currently is, because IMHO it > introduces the concepts more gradually than your proposal. That's ok! It's your PR and I only wanted to show an alternative. I was hoping for a bit more people to provide feedb

[issue27487] -m switch regression in Python 3.5.2 (under rare circumstances)

2016-07-11 Thread Wolfgang Maier
New submission from Wolfgang Maier: As a result of Issue14285 Python 3.5.2 now imports packages in runpy. _get_module_details before calling importlib.util.find_spec. Although I'm not sure how important this is, I wanted to report that this new behaviour can have a side-effect under p

[issue27487] -m switch regression in Python 3.5.2 (under rare circumstances)

2016-07-13 Thread Wolfgang Maier
Wolfgang Maier added the comment: @Martin and regarding Python3.3: Right, you cannot do the replacement when running the module as __main__. For my use case that's not required though so in the module I can just do: if __name__ == '__main__': print('running modul

[issue27487] -m switch regression in Python 3.5.2 (under rare circumstances)

2016-07-14 Thread Wolfgang Maier
Wolfgang Maier added the comment: A warning like this sounds good to me though I'd prefer it to be slightly more verbose, like: "RuntimeWarning: '' found in sys.modules after import of package '', but prior to execution of '' as '__main__'; t

[issue11874] argparse assertion failure with brackets in metavars

2014-10-28 Thread Wolfgang Maier
Wolfgang Maier added the comment: It doesn't seem to be the exact same problem, but still this very simple example with parentheses in metavar fails to format correctly: import argparse parser = argparse.ArgumentParser() parser.add_argument("inputfiles", metavar = 'i

[issue23465] Implement PEP 486 - Make the Python Launcher aware of virtual environments

2015-02-20 Thread Wolfgang Maier
Wolfgang Maier added the comment: am I correct that when a script contains a shebang line like: #! python3 or #! python3.4 i.e., one indicating just a version of, but not a full path to the interpreter, the current patch would not use an active virtualenv even if it has a suitable version

[issue23465] Implement PEP 486 - Make the Python Launcher aware of virtual environments

2015-02-20 Thread Wolfgang Maier
Wolfgang Maier added the comment: isn't the pyvenv.cfg file specifying the version ? -- ___ Python tracker <http://bugs.python.org/issue23465> ___ ___ Pytho

[issue23465] Implement PEP 486 - Make the Python Launcher aware of virtual environments

2015-02-20 Thread Wolfgang Maier
Wolfgang Maier added the comment: > Hmm, I didn't know that (although virtualenv-based environments don't have an > equivalent to pyvenv.cfg). Well, that complicates things then :( > But there's some confusion here. This patch only affects command line usage >

[issue23465] Implement PEP 486 - Make the Python Launcher aware of virtual environments

2015-02-21 Thread Wolfgang Maier
Wolfgang Maier added the comment: >> So, with the current patch users could still not use the py launcher from a >> virtual environment with scripts that are supposed to work under UNIX :( > > Correct. That's not the problem this PEP is intended to solve. Granted :)

[issue25789] py launcher stderr is not piped to subprocess.Popen.stderr

2015-12-03 Thread Wolfgang Maier
New submission from Wolfgang Maier: from the console: > py -3.7 or any other not installed Python version gives: Requested Python version (3.7) not installed However, when the launcher is executed from python via subprocess.Popen: >>>import subprocess >>>p=subproce

[issue25789] py launcher stderr is not piped to subprocess.Popen.stderr

2015-12-04 Thread Wolfgang Maier
Wolfgang Maier added the comment: > The error() function in PC/launcher.c should call exit(rc) instead of > ExitProcess(rc). This allows the CRT to terminate properly and flush the > stderr FILE stream. Interesting. Why do you need to flush stderr? I would have expected it to be u

[issue26501] bytes splitlines() method returns strings without decoding

2016-03-07 Thread Wolfgang Maier
Wolfgang Maier added the comment: works for me too on Windows: Python 3.5.1 (v3.5.1:37a07cee5969, Dec 6 2015, 01:38:48) [MSC v.1900 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more information. >>> u'a\nb£'

[issue26501] bytes splitlines() method returns strings without decoding

2016-03-07 Thread Wolfgang Maier
Wolfgang Maier added the comment: oh and documentation is here: https://docs.python.org/3.5/library/stdtypes.html?highlight=bytes.splitlines#bytes.splitlines -- ___ Python tracker <http://bugs.python.org/issue26

[issue26506] hex() documentation: mention "%x" % int

2016-03-09 Thread Wolfgang Maier
Wolfgang Maier added the comment: Your two suggestions prompted me to do a speed comparison between them and the result surprised me. I tried: import random nums = [random.randint(0, 255) for n in range(1000)] then timed the simple: for n in nums: hx = '%X' % n # or hx

[issue26506] hex() documentation: mention "%x" % int

2016-03-09 Thread Wolfgang Maier
Wolfgang Maier added the comment: Ah, but it's not that format() is slower in 3.5, but that %-formatting got faster. It looks as if it got optimized and I was wondering whether the same optimization could be applied to format(). -- ___ P

[issue26506] hex() documentation: mention "%x" % int

2016-03-10 Thread Wolfgang Maier
Wolfgang Maier added the comment: > Hum, python3 looks faster on this dummy microbenchmark yeah. Who said that > Python 3 is slower? :-) If you're alluding to that seemingly endless thread over on python-list, let me say that it is not my motivation to start anything like that

[issue18378] locale.getdefaultlocale() fails on Mac OS X with default language set to English

2016-04-18 Thread Wolfgang Maier
Wolfgang Maier added the comment: ping? Just ran into this issue on OS X El Capitan with Region set to Germany and Language to English. Just as Ned pointed out 2 years ago, this results in LC_CTYPE set to 'UTF-8' in the terminal and docutils still can't cope with it.

[issue26904] Difflib quick_ratio() could use Counter()

2016-05-02 Thread Wolfgang Maier
Wolfgang Maier added the comment: Given your comment about sum((fullacount & fullbcount).values()), why not use its in-place version: fullacount &= fullbcount matches = sum(fullacount.values()) ? -- nosy: +wolma ___ Python tracke

[issue23688] unnecessary copying of memoryview in gzip.GzipFile.write ?

2015-03-17 Thread Wolfgang Maier
New submission from Wolfgang Maier: I thought I'd go back to work on a test patch for issue21560 today, but now I'm puzzled by the explicit handling of memoryviews in gzip.GzipFile.write. The method is defined as: def write(self,data): self._check_closed() if

[issue23688] unnecessary copying of memoryview in gzip.GzipFile.write ?

2015-03-17 Thread Wolfgang Maier
Changes by Wolfgang Maier : -- keywords: +patch Added file: http://bugs.python.org/file38521/memoryview_write.patch ___ Python tracker <http://bugs.python.org/issue23

[issue23688] unnecessary copying of memoryview in gzip.GzipFile.write ?

2015-03-17 Thread Wolfgang Maier
Wolfgang Maier added the comment: Here is a patch with memoryview tests. Are tests and code patches supposed to go in one file or separate ones ? -- Added file: http://bugs.python.org/file38526/test_memoryview_write.patch ___ Python tracker <h

[issue23688] unnecessary copying of memoryview in gzip.GzipFile.write ?

2015-03-17 Thread Wolfgang Maier
Wolfgang Maier added the comment: @Serhiy: Why would data = data.cast('B') be required ? When would the memoryview not be in 'B' format already ? -- ___ Python tracker <http://bug

[issue23688] unnecessary copying of memoryview in gzip.GzipFile.write ?

2015-03-17 Thread Wolfgang Maier
Wolfgang Maier added the comment: > memoryview is converted to bytes because len() for memoryview returns a size > of first dimension (a number of items for one-dimension view), not a number > of bytes. > >>>> m = memoryview(array.array('I', [1, 2, 3]))

[issue23688] unnecessary copying of memoryview in gzip.GzipFile.write?

2015-03-18 Thread Wolfgang Maier
Wolfgang Maier added the comment: Thanks everyone for the lively discussion ! I like Serhiy's idea of making write work with arbitrary objects supporting the buffer protocol. In fact, I noticed before that GzipFile.write misbehaves with array.array input. It pretends to accept that

[issue23700] tempfile.NamedTemporaryFile can close too early if used as iterator

2015-03-19 Thread Wolfgang Maier
Changes by Wolfgang Maier : -- nosy: +wolma ___ Python tracker <http://bugs.python.org/issue23700> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue23700] tempfile.NamedTemporaryFile can close too early if used as iterator

2015-03-20 Thread Wolfgang Maier
Wolfgang Maier added the comment: I think this is a consequence of PEP380 and its decision to finalize the subgenerator when the delegating generator is closed. Consider this simple example without tempfile: def yielder (fileobj): yield from fileobj with open('some_test_file',

[issue23700] tempfile.NamedTemporaryFile can close too early if used as iterator

2015-03-20 Thread Wolfgang Maier
Wolfgang Maier added the comment: Actually, its scary that use of yield from can have such a subtle side-effect. Maybe PEP380 should have taken this more seriously? -- ___ Python tracker <http://bugs.python.org/issue23

[issue23700] tempfile.NamedTemporaryFile can close too early if used as iterator

2015-03-20 Thread Wolfgang Maier
Wolfgang Maier added the comment: @Serhiy in this line of code: reader = csv.DictReader(fileobj, fieldnames=next(csv.reader(fileobj))) csv.reader(fileobj) returns the generator created by fileobj.__iter__, but no reference to it is kept so the object gets destroyed right afterwards. This

[issue23700] tempfile.NamedTemporaryFile can close too early if used as iterator

2015-03-20 Thread Wolfgang Maier
Wolfgang Maier added the comment: @bkabrda not sure, but it may have to do with when exactly the object gets garbage collected -- ___ Python tracker <http://bugs.python.org/issue23

[issue23688] unnecessary copying of memoryview in gzip.GzipFile.write?

2015-03-20 Thread Wolfgang Maier
Wolfgang Maier added the comment: ok, I've prepared a patch including tests based on my last suggestion, which I think is ready for getting reviewed. -- Added file: http://bugs.python.org/file38600/write_bytes_like_objects.patch ___ Python tr

[issue23529] Limit decompressed data when reading from LZMAFile and BZ2File

2015-03-20 Thread Wolfgang Maier
Wolfgang Maier added the comment: The patch has a huge block replacement in the gzip.py module starting at GzipFile.write, which makes it large and hard to identify changes. Could that be ameliorated or is it too much work right now? -- nosy: +wolma

[issue23700] tempfile.NamedTemporaryFile can close too early if used as iterator

2015-03-20 Thread Wolfgang Maier
Wolfgang Maier added the comment: so let's look at this step-by-step (and I hope I fully understood this myself): - calling fileobj.__iter__ creates a generator because the method uses yield from - that generator does not get assigned to any reference so it will be garbage-collected -

[issue23700] tempfile.NamedTemporaryFile can close too early if used as iterator

2015-03-20 Thread Wolfgang Maier
Wolfgang Maier added the comment: You are probably right that the io classes are broken. >From https://docs.python.org/3/library/stdtypes.html#iterator-types: Once an iterator’s __next__() method raises StopIteration, it must continue to do so on subsequent calls. Implementations that do

[issue23700] tempfile.NamedTemporaryFile can close too early if used as iterator

2015-03-20 Thread Wolfgang Maier
Wolfgang Maier added the comment: OTOH, it would be very hard to change the way fileobjects compared to designing yield from differently so I'd still blame it partly. Maybe it is unfortunate that generators have a close method instead of, say, __cl

[issue23378] argparse.add_argument action parameter should allow value extend

2015-03-22 Thread Wolfgang Maier
Wolfgang Maier added the comment: > - I haven't seen other requests for it For the record, an Extend custom action class is one of very few such classes I have ever written for argparse for exactly the OP's usecase, i.e., it is useful for any parser that should accept the same op

[issue23688] unnecessary copying of memoryview in gzip.GzipFile.write?

2015-03-22 Thread Wolfgang Maier
Wolfgang Maier added the comment: Here is a revised version of my patch addressing Serhiy's review comments. -- Added file: http://bugs.python.org/file38639/write_bytes_like_objects_v2.patch ___ Python tracker <http://bugs.python.org/is

[issue23688] unnecessary copying of memoryview in gzip.GzipFile.write?

2015-03-23 Thread Wolfgang Maier
Changes by Wolfgang Maier : Added file: http://bugs.python.org/file38650/write_bytes_like_objects_v3.patch ___ Python tracker <http://bugs.python.org/issue23688> ___ ___

[issue23688] unnecessary copying of memoryview in gzip.GzipFile.write?

2015-03-23 Thread Wolfgang Maier
Wolfgang Maier added the comment: ouch. haven't thought of this. OTOH, just plain io with your example: with open('xy', 'wb') as f: f.write(y) Traceback (most recent call last): File "", line 2, in f.write(y) BufferError: memoryview: underlying bu

[issue23688] unnecessary copying of memoryview in gzip.GzipFile.write?

2015-03-23 Thread Wolfgang Maier
Wolfgang Maier added the comment: to preserve compatibility: there is the memoryview.c_contiguous flag. Maybe we should just check it and if it is False fall back to the old copying behavior ? -- ___ Python tracker <http://bugs.python.

[issue23688] unnecessary copying of memoryview in gzip.GzipFile.write?

2015-03-23 Thread Wolfgang Maier
Wolfgang Maier added the comment: something like: def write(self,data): self._check_closed() if self.mode != WRITE: import errno raise OSError(errno.EBADF, "write() on read-only GzipFile object") if self.fileobj is None:

[issue23688] unnecessary copying of memoryview in gzip.GzipFile.write?

2015-03-23 Thread Wolfgang Maier
Wolfgang Maier added the comment: Serhiy: I think I saw that you committed this also to the 2.7 branch, but that would not work since memoryviews do not have the nbytes attribute (they do not seem to have cast either). One would have to calculate the length instead from other properties

[issue23688] unnecessary copying of memoryview in gzip.GzipFile.write?

2015-03-23 Thread Wolfgang Maier
Wolfgang Maier added the comment: I see now that it is just issue21560 that went into 2.7 and that's fine. As I said: sorry for the noise -- ___ Python tracker <http://bugs.python.org/is

[issue23602] Implement __format__ for Fraction

2015-03-26 Thread Wolfgang Maier
Wolfgang Maier added the comment: actually, I'm not sure whether formatting Decimals gives correct output under all conditions (correctly rounded yes, but maybe not formatted correctly?). compare: >>> format(float('1.481e-6'),'.3g') '1.48e-0

[issue23602] Implement __format__ for Fraction

2015-03-26 Thread Wolfgang Maier
Wolfgang Maier added the comment: > Decimal formatting intentionally differs from float formatting, see #23460. I see. Thanks for the pointer. What about the missing zero in the exponent ? -- ___ Python tracker <http://bugs.python.org/issu

[issue23787] sum() function docstring lists arguments incorrectly

2015-03-28 Thread Wolfgang Maier
Wolfgang Maier added the comment: >This implies sum() should accept str, unicode, list, tuple, bytearray, buffer, >and xrange. and in fact it *does* accept all these as input. It just refuses to add the elements of the sequence if these elements are of certain types. Of course, the el

[issue23602] Implement __format__ for Fraction

2015-03-29 Thread Wolfgang Maier
Wolfgang Maier added the comment: Initially, I also thought that this should be addressable with Fraction.__round__ or an optimized variation of it, but Tuomas is right that it gets complicated by the fact that you need to cope with the different format specifiers and not all of them fit the

[issue23466] PEP 461: Inconsistency between str and bytes formatting of integers

2015-04-04 Thread Wolfgang Maier
Wolfgang Maier added the comment: the new test: test_exc('%x', '1', TypeError, "%x format: a number is required, not str") expects the wrong error message. python -m unittest -v test.test_format ... '%x' % '1' works? ... no Unexpect

[issue16125] open accepts arbitrary mode strings as long as they contain U

2015-04-13 Thread Wolfgang Maier
Wolfgang Maier added the comment: I'm able to reproduce this with Python 2.7.6 on Linux, but not 2.7.9 on Windows. Is this a POSIX-only bug or has it been fixed in the meantime ? -- nosy: +wolma ___ Python tracker <http://bugs.python.org/is

[issue23933] Struct module should acept arrays

2015-04-13 Thread Wolfgang Maier
Wolfgang Maier added the comment: are you looking for: struct.pack('i'*4, *[0]*4) ? -- nosy: +wolma ___ Python tracker <http://bugs.python.o

[issue23933] Struct module should acept arrays

2015-04-13 Thread Wolfgang Maier
Wolfgang Maier added the comment: I'm afraid you lost me and I do not see what your problem is here. Maybe you should raise this on one of the Python mailing lists (see https://www.python.org/community/lists/) ? -- ___ Python tracker

[issue23933] Struct module should acept arrays

2015-04-13 Thread Wolfgang Maier
Changes by Wolfgang Maier : -- nosy: -wolma ___ Python tracker <http://bugs.python.org/issue23933> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue5680] Command-line arguments when running in IDLE

2015-04-16 Thread Wolfgang Maier
Changes by Wolfgang Maier : -- nosy: +wolma ___ Python tracker <http://bugs.python.org/issue5680> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue23975] numbers.Rational implements __float__ incorrectly

2015-04-16 Thread Wolfgang Maier
New submission from Wolfgang Maier: numbers.Rational defines __float__ like this: def __float__(self): """float(self) = self.numerator / self.denominator It's important that this conversion use the integer's "true" division rather than castin

[issue23985] Crash when deleting slices from duplicated bytearray

2015-04-17 Thread Wolfgang Maier
Wolfgang Maier added the comment: Also happening with Python 3.4.0 on Ubuntu 14.04 (after ~ half a minute and A LOT of output): [skipping lots of lines] buf2: 29 13 bytearray(b'12312345678901231234567890123') buf1: 25 9 bytearray(b'2345678901231234567890123') bu

[issue23985] Crash when deleting slices from duplicated bytearray

2015-04-17 Thread Wolfgang Maier
Wolfgang Maier added the comment: Surprisingly, a much simpler version with just one bytearray seems to run stably (for several minutes at least), but when you wait a while then hit Ctrl-C, you are getting a Segmentation fault: Python 3.4.0 (default, Apr 11 2014, 13:05:11) [GCC 4.8.2] on

[issue23975] numbers.Rational implements __float__ incorrectly

2015-04-20 Thread Wolfgang Maier
Wolfgang Maier added the comment: Good point. If the numbers ABC guaranteed numerator and denominator to be Integral numbers, this could be solved by: return float(int(self.numerator) / int(self.denominator)) but since both could be Rationals again that does not seem to be an option either

[issue23975] numbers.Rational implements __float__ incorrectly

2015-04-20 Thread Wolfgang Maier
Wolfgang Maier added the comment: > Is it not reasonable to simply say that implementations of numbers.Rational > which allow the numerator and denominator to have types for which true > division doesn't return a float, have to provide their own implementation of > __float__(

[issue23356] In argparse docs simplify example about argline

2015-04-24 Thread Wolfgang Maier
Changes by Wolfgang Maier : -- nosy: +wolma ___ Python tracker <http://bugs.python.org/issue23356> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue22881] show median in benchmark results

2015-04-26 Thread Wolfgang Maier
Changes by Wolfgang Maier : -- nosy: +wolma ___ Python tracker <http://bugs.python.org/issue22881> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue22881] show median in benchmark results

2015-04-26 Thread Wolfgang Maier
Wolfgang Maier added the comment: for the even number case, I think you shouldn't do // 2, but / 2. In general, wouldn't it be good to let the statistics module do all the stats calculations? -- ___ Python tracker <http://bu

[issue22881] show median in benchmark results

2015-04-26 Thread Wolfgang Maier
Wolfgang Maier added the comment: > It's not available in older Python versions, e.g. 2.6. I know, I was talking about 3.5+, of course. This would not be backported to Python2 anyway, would it? -- ___ Python tracker <http://bugs

[issue22881] show median in benchmark results

2015-04-26 Thread Wolfgang Maier
Wolfgang Maier added the comment: ah sorry, it's late here already and I forgot what file this change is about. So forget my last comment then. -- ___ Python tracker <http://bugs.python.org/is

[issue23975] numbers.Rational implements __float__ incorrectly

2015-04-27 Thread Wolfgang Maier
Wolfgang Maier added the comment: After considering this for a while, I think: return float(self.numerator / self.denominator) is the best solution: * it is simple and works reasonably well as a default * it fixes Rational.__float__ for cases, in which numerator / denominator returns a

[issue24068] statistics module - incorrect results with boolean input

2015-04-28 Thread Wolfgang Maier
Changes by Wolfgang Maier : Removed file: http://bugs.python.org/file39220/statistics._sum.patch ___ Python tracker <http://bugs.python.org/issue24068> ___ ___ Python-bug

[issue24068] statistics module - incorrect results with boolean input

2015-04-28 Thread Wolfgang Maier
Changes by Wolfgang Maier : Added file: http://bugs.python.org/file39221/statistics._sum.patch ___ Python tracker <http://bugs.python.org/issue24068> ___ ___ Python-bug

[issue24068] statistics module - incorrect results with boolean input

2015-04-28 Thread Wolfgang Maier
New submission from Wolfgang Maier: the mean function in the statistics module gives nonsensical results with boolean values in the input, e.g.: >>> mean([True, True, False, False]) 0.25 >>> mean([True, 1027]) 0.5 This is an issue with the module's internal _sum funct

[issue8538] Add FlagAction to argparse

2015-04-29 Thread Wolfgang Maier
Changes by Wolfgang Maier : -- nosy: +wolma ___ Python tracker <http://bugs.python.org/issue8538> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue24068] statistics module - incorrect results with boolean input

2015-05-02 Thread Wolfgang Maier
Wolfgang Maier added the comment: uploading an alternate, possibly slightly clearer version of the patch -- Added file: http://bugs.python.org/file39269/statistics._sum.v2.patch ___ Python tracker <http://bugs.python.org/issue24

[issue28115] Use argparse for the zipfile module

2016-10-18 Thread Wolfgang Maier
Changes by Wolfgang Maier : -- nosy: +wolma ___ Python tracker <http://bugs.python.org/issue28115> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue28637] Python startup performance regression

2016-11-08 Thread Wolfgang Maier
Wolfgang Maier added the comment: STINNER Victor added the comment: >BUT when Python is started from a virtual environment (created by the >"venv" module), the re module is important by default. > >haypo@speed-python$ venv/bin/python3 -c 'import sys; print("re&quo

<    1   2   3   >