Steven D'Aprano added the comment:
Wolfgang,
Thanks for the patch, I have some concerns about it, but the basic idea
does look reasonable. However, I've been convinced that supporting mixed
types at all needs more careful thought. Under the circumstances, I'm
more concerned ab
Steven D'Aprano added the comment:
Attached is a patch which:
- documents that mixed types are not currently supported;
- changes the behaviour of _sum to raise TypeError on mixed input
types (mixing int and is allowed, but nothing else);
- updates the tests;
- adds some document
Steven D'Aprano added the comment:
Fix as suggested by Nick, and new test.
--
keywords: +patch
Added file: http://bugs.python.org/file33983/counter.patch
___
Python tracker
<http://bugs.python.org/is
Steven D'Aprano added the comment:
On Sat, Feb 08, 2014 at 11:29:29AM +, Stefan Krah wrote:
> This looks like a duplicate of #20536. Steven, do you think you
> have a chance to fix this before rc1?
Working on it now. Should have a patch and regression tests in 15
minutes, I
Steven D'Aprano added the comment:
See also issue 20561, which is a duplicate of this.
Fix and tests for this in the attached patch. Could somebody please commit it
for me, my ssh key apparently hasn't been registered yet.
--
assignee: -> stevenjd
keywords: +patch
Steven D'Aprano added the comment:
> LF or CR cannot be part of a URI
But they can be part of a filename, at least on POSIX systems. Are you
proposing that only the Windows version of os.path.join strip LF/CR?
I don't think that it up to the join function to validate the path, a
Steven D'Aprano added the comment:
I don't know how to interpret this. Where can I find out more about refleak
mode? Thanks.
--
___
Python tracker
<http://bugs.python.o
Steven D'Aprano added the comment:
I think you may have misread PEP 8. It does not recommend a trailing underscore
for names that shadow built-ins (e.g. file_ instead of file), it only
recommends a trailing underscore when you need to use a keyword as a name (e.g.
class_ instead of
Steven D'Aprano added the comment:
If this is undefined, and I think it should be, the docs should explicitly say
so. How is this?
The union and intersection operations select elements which appear in both
operands, e.g. set([a, b, c]) & set([c, d, e]) returns set([c]). The sele
Changes by Steven D'Aprano :
--
nosy: +stevenjd
___
Python tracker
<http://bugs.python.org/issue3366>
___
___
Python-bugs-list mailing list
Unsubsc
New submission from Steven D'Aprano :
In Python 2.6, .pyc files inherit the executable bit from their .py
file. This can lead to strangeness:
$ echo pass > test.py
$ chmod u+x test.py
$ python2.6 -c "import test"
$ ls -l test.pyc
-rwxrw-r-- 1 steve steve 94 2009-09
New submission from Steven D'Aprano :
The table of string formatting conversions has a mispelling:
http://docs.python.org/library/stdtypes.html#string-formatting
'u' Obselete type – it is identical to 'd'.
Should be "Obsolete".
--
assignee: geo
Steven D'Aprano added the comment:
What's wrong with this?
ob = map[x][y].overpay
if ob:
ob.blit(x, y)
Is this proposal just about saving one line?
If we allow this, how many of the following will be allowed?
if expr as name:
while expr as name:
expr as name # alternativ
Steven D'Aprano added the comment:
Regarding the proposed syntax:
if (f() == 'spam') -> name:
newname = name.replace('p', 'h')
Surely that should assign the *bool* result of comparing f()
with 'spam' to name? Doing anything else is opening
Steven D'Aprano added the comment:
Matthew suggested ~= instead of -> or "as".
I dislike this because ~= first makes me think of "approximately equal
to", and then it makes me think of augmented assignment, and only then
do I remember that although ~ is used in P
New submission from Steven D'Aprano :
In the itertools recipes section of the docs, powerset() is listed
twice.
http://docs.python.org/library/itertools.html#recipes
--
assignee: georg.brandl
components: Documentation
messages: 86155
nosy: georg.brandl, stevenjd
severity: n
New submission from Steven D'Aprano :
In the documentation for itertools, the Python equivalent to izip has
a typo:
yield yield tuple(map(next, iterables))
Obviously should only have a single yield.
http://docs.python.org/library/itertools.html#itertools.izip
--
ass
New submission from Steven D'Aprano :
I'm not sure if this is a documentation bug or a behaviour bug, or
possibly both.
The documentation warns about adding or deleting items from a dict
while iterating over it:
"Using iteritems() while adding or deleting entries in the d
Steven D'Aprano added the comment:
I agree with Terry Reedy. I'm re-opening it as a documentation bug (if
I can -- if I can't, I'll just request somebody who can do so).
--
components: -Interpreter Core
status: closed -> open
___
Steven D'Aprano added the comment:
With respect Georg, given that the behaviour won't be changed, the
documentation is simply *wrong*. It's not a matter of telling
people "don't do this" -- somebody, somewhere, is going to rely on the
documented behaviour. T
Steven D'Aprano added the comment:
I had a brief look at the source for ABCMeta, and it seems to me that the
__module__ behaviour is coming from `type`. I'm not sure whether it can, or
should, can be fixed in type, but I think that the correct behaviour for
ABCMeta is to set __modul
Steven D'Aprano added the comment:
Hi John, and thanks for the bug report. If only they were all as easily
resolved as this one :-)
With respect, if you're just getting started with Python, you shouldn't get
into the habit of hitting the bug tracker every time you find
Steven D'Aprano added the comment:
On Tue, Dec 13, 2016 at 09:35:22AM +, Srikanth Anantharam wrote:
>
> Srikanth Anantharam added the comment:
>
> A better choice would be to return a tuple of values (sliced from the
> table). And let the user decide which one to us
Steven D'Aprano added the comment:
I independently raised this on Python-Ideas and the initial responses are that
vars() should support objects with slots too.
https://mail.python.org/pipermail/python-ideas/2016-December/043965.html
--
nosy: +steven.daprano
versions: +Pytho
Steven D'Aprano added the comment:
On Tue, Dec 13, 2016 at 10:08:10AM +, Srikanth Anantharam wrote:
> Please see the updated pull request PR 50, with the changes.
I'm rejecting that pull request. As I said, mode() intentionally
returns only the single, unique mode. I m
Steven D'Aprano added the comment:
On Tue, Dec 13, 2016 at 10:17:21AM +, Srikanth Anantharam wrote:
>
> Srikanth Anantharam added the comment:
>
> @steven:
>
> data = [1, 2, 3, 4, 4, 4, 5, 6, 7, 7, 8, 8, 8, 8, 8, 8, 8, 9, 9]
> is clearly unimodal with mode 8
Steven D'Aprano added the comment:
You haven't given any reason to explain why you think the existing docs are
wrong, nor any reason why you think your version is better. Just stating that
the docs give "misinformation" is not good enough.
By your matrix, 'Python
Steven D'Aprano added the comment:
> _randbelow is a private api and it is not broken, it is just being
> misused by the secrets module.
"Misused" seems a bit strong. Should I understand that you dislike the
wrapper around _randbelow? The implementation was given in
New submission from Steven D'Aprano:
argparse help incorrectly breaks long lines on U+u00A0 NO-BREAK SPACE.
The attached script has been run on Python 3.5.3rc1 in a terminal window 80
columns wide, and it produces output::
usage: argparse_nobreak.py [-h] [--no-condensed]
opt
Changes by Steven D'Aprano :
Removed file: http://bugs.python.org/file46310/argparse_nobreak.py
___
Python tracker
<http://bugs.python.org/issue29290>
___
___
Pytho
Steven D'Aprano added the comment:
Here's a slightly simpler demo, without the (fortunately harmless) typo.
--
Added file: http://bugs.python.org/file46311/argparse_nobreak.py
___
Python tracker
<http://bugs.python.o
Steven D'Aprano added the comment:
On Sun, Jan 29, 2017 at 08:23:05AM +, Martin Panter wrote:
> Why do you name the methods is_finite() etc with underscores, when the
> existing methods math.isfinite() etc do not have underscores? Seems it
> would add unnecessary confusion.
Steven D'Aprano added the comment:
re.match only matches at the start of the string. If you use re.search instead,
you will get the results you are expecting.
--
nosy: +steven.daprano
resolution: -> not a bug
stage: -> resolved
status: ope
Steven D'Aprano added the comment:
Serhiy, that doesn't generalise to code like:
any(a, b, c, *extras)
which is hard to write out by hand. You would have to say
bool(a or b or c or any(extras))
I think this might be worth considering on Python-Ideas. It will probably be
Steven D'Aprano added the comment:
> Do you think I should send a mail to the ideas list?
Personally, I don't think so. You want to write any(a, b, c, d),
but you can get the same effect now by writing any([a, b, c, d]).
There is unlikely to be any significant performan
Changes by Steven D'Aprano :
--
nosy: +steven.daprano
___
Python tracker
<http://bugs.python.org/issue12741>
___
___
Python-bugs-list mailing list
Unsubscr
Changes by Steven D'Aprano :
--
versions: +Python 3.7 -Python 3.3
___
Python tracker
<http://bugs.python.org/issue12741>
___
___
Python-bugs-list m
Steven D'Aprano added the comment:
What about "administrative data structures" that should be copied?
I think that "administrative data structures" is a red herring: there could be
data that needs copying, and data that needs sharing and shouldn't be copied,
i
Steven D'Aprano added the comment:
Only 3.7 can receive new functionality.
Here is a pure Python implementation of a subsequence test:
https://code.activestate.com/recipes/577850-search-sequences-for-sub-sequence/
It appears to be reasonably popular on Activestate: it has about 7000
Steven D'Aprano added the comment:
I agree with Josh: the exception you are giving doesn't seem possible with the
code snippet shown. Please COPY AND PASTE (not a screen shot) the text of the
entire traceback, starting with the line "Traceback..."
I suspect that you m
Steven D'Aprano added the comment:
Terry, I'm not sure if you've read this enhancement request correctly or not,
because your reply when closing covers over a lot of detail which is not
relevant to this feature request.
> Extending this idea to 'subsequence in sequenc
Steven D'Aprano added the comment:
Confirmed that in Python 2.7 calling g() before and after modifying the dict
prints 3 both times; calling g() before modifying the dict prints 3, then after
modifying it prints 5.
Python 3.3 behaves like 2.7, so this sounds like a regression in 3.5 or
Changes by Steven D'Aprano :
--
nosy: +steven.daprano
___
Python tracker
<http://bugs.python.org/issue29602>
___
___
Python-bugs-list mailing list
Unsubscr
Steven D'Aprano added the comment:
I am unable to replicate this in Python 2.7, 3.3 or 3.6. I haven't bothered to
test against other versions, because I think that this is a PyShell issue, not
a Python issue. (I think you are using PyShell, based on the traceback given.)
Before repo
Steven D'Aprano added the comment:
On Mon, May 30, 2016 at 01:43:22AM +, ppperry wrote:
> steven.daprano, you don't appear to have properly read the issue
> comments.
Ack; I saw your comment about the metaclass, then saw your retraction
of the metaclass issue, then mis
Steven D'Aprano added the comment:
Yes. What does such an assertion actually mean?
Why would I write `self.assertNotRaises(ValueError, spam, arg)` rather than
just call `spam(arg)`? The only difference is that assertNotRaises will treat
one specific exception as a test failure rather t
Steven D'Aprano added the comment:
On Thu, Jun 02, 2016 at 09:04:54PM +, Raymond Hettinger wrote:
> Steven, this seems like a reasonable suggestion (though I would expect
> someone else will immediately suggest a harmonic mean as well). Is
> this within the scope of what y
Steven D'Aprano added the comment:
"file://a" is a valid relative file path, for a directory called "file:" and a
file called "a", so normpath should return "file:/a".
--
nosy: +steven.daprano
___
Pytho
Steven D'Aprano added the comment:
Yes, it is intended. Commas create tuples, not parentheses. (With the exception
of the empty tuple.) The parens are just for grouping and precedence. `1,` is a
tuple, regardless of whether you use parens around it or not.
--
nosy: +steven.da
Steven D'Aprano added the comment:
On Thu, Jun 09, 2016 at 09:24:04AM +, Mark Dickinson wrote:
> On the other hand, apparently `exp(mean(log(...)))` is good enough for SciPy:
Hmm, well, I don't have SciPy installed, but I've found that despite
their (well-deserved) repu
Steven D'Aprano added the comment:
I don't want to start another huge thread on python-dev unless really
necessary. What should happen to random.SystemRandom?
(1) nothing, it stays as it is, and if ``secrets`` needs better, it can
subclass it;
(2) it changes to use ``os.getrandom``
New submission from Steven D'Aprano:
Write some documentation for the ``secrets`` module summarizing the issues
relating to /dev/[u]random, getrandom, etc. There's a lot of confusion about
these issues, and the web contains a lot of misinformation, so being able to
point to the se
Steven D'Aprano added the comment:
Relevant: issue #27293
(I've taken the liberty of subscribing those on this issues nosy list to the
new issue, I hope that's okay)
--
nosy: +steven.daprano
___
Python tracker
<http://bugs.pyt
Steven D'Aprano added the comment:
Thanks Julio,
I hope to get to this over the next week. Please feel free to prod me if
you see no action by then.
--
___
Python tracker
<http://bugs.python.org/is
New submission from Steven D'Aprano:
The docs for locals() warn not to write to the dict returned, as it may not
have the intended effect of modifying the actual variables seen by the
interpreter.
https://docs.python.org/3/library/functions.html#locals
But as I understanding it, using l
New submission from Steven D'Aprano:
For Issue27181 (add geometric mean to statistics module), I need a function to
calculate nth roots that is more accurate than pow(x, 1/n). E.g. math.pow(1000,
1/3) returns 9.998 instead of 10.0.
I have a pure-Python implementation of
Steven D'Aprano added the comment:
I suggested on python-ideas that the math module be given a pure-Python front
end. Guido wasn't too keen on that idea, so I won't push for it.
He did agree that having nroot in math was a reasonable idea. If I attach a
pure Python implement
Steven D'Aprano added the comment:
For starters, dunder names like __json__ are reserved for Python's own use, so
you would have to get the core developers to officially bless this use.
But... I'm not really sure that "the responsibility of determining how an
object shou
Steven D'Aprano added the comment:
On Mon, Jun 20, 2016 at 09:02:09PM +, Tim Peters wrote:
> Note that the very popular TI graphics calculators have had a distinct
> nth-root function at least since the TI-83. It's a minor convenience
> there.
Likewise HP calculato
Steven D'Aprano added the comment:
On Sat, Jul 02, 2016 at 11:40:48AM +, Utkan Gezer wrote:
>
> New submission from Utkan Gezer:
>
> An issue of enhancement by the introduction of a built-in product()
> function for the multiplication operation, functions similar to
Steven D'Aprano added the comment:
I know this issue is closed, but for future reference, ShubhamSingh.er, if you
submit any further bug reports, please don't submit screen shots unless
necessary. Just copy and paste the text from your terminal into the issue
tracker. A screen sh
Steven D'Aprano added the comment:
Hi Zhihan Chen, I see this issue is closed, but for future reference please
don't post screenshots to report issues unless they are really needed. For text
output, just copy the text from your terminal and paste it into your bug
report. Making a s
Steven D'Aprano added the comment:
I haven't studied your code in detail (I won't be qualified to judge it) but I
notice this comment:
/* Hit the faster unicode_concatenate method if and only if
all the following conditions are true:
1. The left operand is a unic
Steven D'Aprano added the comment:
The behaviour of both are correct: the binary float nearest to 4.4 is just a
smidgen *bigger* than the exact decimal 4.4, so 44//4.4 truncates to 9.0. But
floor(44/4.4) evaluates 44/4.4 first, and that rounds rather than truncating,
giving 10.0, which
Steven D'Aprano added the comment:
Does anyone have any strong feeling about the name for these functions?
gmean and hmean;
geometric_mean and harmonic_mean
And "subcontrary_mean" is not an option :-)
--
___
Python tracker
<http
Steven D'Aprano added the comment:
Raymond, that was a fantastic explanation. Would you be willing to turn it into
a FAQ? Or if you don't have the time, to allow somebody to steal your
description and use it?
--
nosy: +steven.daprano
New submission from Steven D'Aprano:
Way too often I've lost track of whether I'm in the code.interact() REPL or the
original REPL, or hit Ctrl-D once too often, and accidentally quit the real
REPL. It is easy to lose track, since the real and imitation REPL both use the
sa
Changes by Steven D'Aprano :
Removed file: http://bugs.python.org/file43791/code.patch
___
Python tracker
<http://bugs.python.org/issue27573>
___
___
Python-bugs-l
Steven D'Aprano added the comment:
This time, with a patch that includes updated tests.
--
Added file: http://bugs.python.org/file43793/code.patch
___
Python tracker
<http://bugs.python.org/is
Steven D'Aprano added the comment:
I'm reluctant to call this a behaviour bug, because I'm reluctant to guarantee
the *precise* behaviour when the classes are different.
I haven't checked the source of dict.__contains__, but by experimentation it
seems that:
needle in
New submission from Steven D'Aprano:
As reported here:
https://mail.python.org/pipermail/python-list/2016-July/711333.html
there's a possible annoyance with getopt when you accidentally leave whitespace
on a long option. On my Centos system, getopt ignores leading and trailing
whi
Steven D'Aprano added the comment:
Thanks for the quick review, I've fixed the issues you mentioned.
--
Added file: http://bugs.python.org/file43886/getopt.patch
___
Python tracker
<http://bugs.python.o
Steven D'Aprano added the comment:
On Tue, Jul 26, 2016 at 04:50:33AM +, Serhiy Storchaka wrote:
> My answer: if you don't want a space in your long_option, don't put a
> space in there. There is no a bug in Python,
That's why I listed it as an enhancement, n
Steven D'Aprano added the comment:
I expect that ESC should always cancel, and RETURN/ENTER should always accepts
(OK or Save or whatever the "main" button is) regardless of where the focus is.
If you want a keyboard shortcut to push the button with focus, use SP
Steven D'Aprano added the comment:
Serhiy Storchaka added the comment:
> It makes Python getopt behave less like the C getopt.
Exactly! If C getopt allows whitespace in long options, it's a GOOD
thing to avoid such a poor design. Who would want a option --foo (note
the t
Steven D'Aprano added the comment:
On Tue, Jul 26, 2016 at 03:27:29PM +, R. David Murray wrote:
[...]
> getopt is explicitly emulating the C getopt
There are lots of differences between the C getopt and the Python
version, and the Python version is described as offering an API
&
Steven D'Aprano added the comment:
Nick gave a +1 to my auto-range patch with callback on 2016-05-13, and there's
been no negative feedback since. Should I go ahead and check it in for 3.6?
--
___
Python tracker
<http://bugs.python.
Steven D'Aprano added the comment:
Your description is hard to understand, and doesn't give enough detail, but I
*think* I can guess what you might be referring to.
If you start with a really big integer, and divide, you get a float. But really
big floats cannot represent every numb
Steven D'Aprano added the comment:
> Converting n to an int
Oops. Obviously I meant converting n *from* an int *to* a float.
--
___
Python tracker
<http://bugs.python.org
Steven D'Aprano added the comment:
On Tue, Aug 09, 2016 at 06:44:22AM +, Ram Rachum wrote:
> For `geometric_mean`, maybe I'd add one sentence that describes
> how the geometric mean is calculated.
What do you mean? As in, the mathematical definition of geometric mean?
Or d
Steven D'Aprano added the comment:
If this is added, should this signum function be the two value version that
returns 1 for zero, or the three value version that returns 0? Should it
distinguish between signed zeroes +0.0 and -0.0? What should it do for NANs
(raise, return a NAN, cop
Steven D'Aprano added the comment:
I thought about special-casing n=2 to math.sqrt, but as that's an
implementation detail I can make that change at any time. According
to my testing, math.pow(x, 0.5) is no worse than sqrt, so I'm not
sure if there's any advantage to havin
Steven D'Aprano added the comment:
That is not a bug, it is a feature. `eval` only evaluates *expressions*, not
statements, and `import` is a statement. Neither of those is going to change.
Starting in Python 3.1, you could use `import_module`:
https://docs.python.org/3/library/importlib
Steven D'Aprano added the comment:
Correction: `importlib.import_module` is also available in Python 2.7.
--
___
Python tracker
<http://bugs.python.org/is
New submission from Steven D'Aprano:
First reported by Martin Panter here:
http://bugs.python.org/issue27181#msg272488
I'm afraid I don't know enough about PowerPC to suggest a fix other than
weakening the test on that platform.
--
assignee: steven.daprano
messag
Steven D'Aprano added the comment:
Tests fail on a Power PC buildbot:
http://buildbot.python.org/all/builders/PPC64LE%20Fedora%203.x/builds/1476/steps/test/logs/stdio
==
FAIL: testExactPowers (test.test_statistics.Test_Nth
Steven D'Aprano added the comment:
I've created a new issue to track the loss of accuracy on PowerPC:
http://bugs.python.org/issue27761
--
___
Python tracker
<http://bugs.python.o
Steven D'Aprano added the comment:
On Sun, Aug 14, 2016 at 08:29:39AM +, Mark Dickinson wrote:
> Steven: can you explain why you think your code *should* be giving
> exact results for exact powers? Do you have an error analysis that
> says that should be the case?
No error
Steven D'Aprano added the comment:
On Sun, Aug 14, 2016 at 10:52:42AM +, Mark Dickinson wrote:
> Same deal here: those aren't the actual errors; they're approximations
> to the errors, since the computations of the epsilons depends on (a)
> the usual floating-
Steven D'Aprano added the comment:
On Sun, Aug 14, 2016 at 12:05:37PM +, Mark Dickinson wrote:
> But I don't think there's a real problem here so long as you don't
> have an expectation of getting super-accurate (e.g., correctly rounded
> or faithfully r
Steven D'Aprano added the comment:
Still to do (coming soon):
- make the 0.2s time configurable;
- have `timeit` and `repeat` methods (and functions) fall back
on `autorange` if the number is set to 0 or None.
--
assignee: -> steven
Changes by Steven D'Aprano :
--
resolution: -> fixed
stage: -> resolved
status: open -> closed
___
Python tracker
<http://bugs.python.org/issue27573>
___
__
Steven D'Aprano added the comment:
On Thu, Aug 18, 2016 at 08:19:25AM +, Armin Rigo wrote:
> Can we make the exit message optional?
Sure. What API do you prefer? I'm thinking to just give interact() an
optional "exitmsg" argument, similar to banner:
def interact(ban
Steven D'Aprano added the comment:
For future reference, don't post screen shots. Copy and paste the text of your
code and its output. You don't program with Photoshop, you program with a text
editor.
Screen shots make it impossible to copy the code, search for the tex
Steven D'Aprano added the comment:
At the risk of muddying the waters even further, I'd like to make _normalize a
public parameter in Python 3.7. There's an interesting operation you can do
with fractions, the mediant:
https://en.wikipedia.org/wiki/Mediant_%28mathe
Changes by Steven D'Aprano :
--
assignee: docs@python -> steven.daprano
nosy: +steven.daprano
___
Python tracker
<http://bugs.python.org/issue27825>
___
_
Steven D'Aprano added the comment:
On Thu, Aug 18, 2016 at 12:26:56PM +, Armin Rigo wrote:
> ...ah, upon closer inspection, we don't use the ``interact()`` method
> anyway. We already copied and tweaked this method: one problem was
> that it gives no way to run withou
Steven D'Aprano added the comment:
Terry J. Reedy added the comment:
> Steven: "You should use `__builtin__` in Python 2 and `builtins` in
> Python 3." I presume this is for import statements.
My understanding is that __builtins__ is intended to be for the privat
Steven D'Aprano added the comment:
I had a work mate make this exact same point literally yesterday. He asked me
if Python had an identity function, and when I suggested just using `lambda x:
x` he grouched that this wasn't sufficiently obvious enough as "identity"
Steven D'Aprano added the comment:
Just in case anyone else thinks this is a good idea, here's a patch.
--
keywords: +patch
Added file: https://bugs.python.org/file44218/identity.patch
___
Python tracker
<https://bugs.python.o
1201 - 1300 of 1443 matches
Mail list logo