Steven D'Aprano added the comment:
I'm afraid I'm unable to replicate this bug report in Python 3.4.
If you are able to replicate it, can you tell us the exact version number of
Python you are using? Also, which operating system are you using?
--
nosy: +steven.daprano
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 you we
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.daprano
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) reputation, nu
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 secrets docs
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 <rep...@bugs.python.org>
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
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. 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 than
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 misinterprete
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 reporting bugs
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 should be repres
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 implementation and tests
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 <rep...@bugs.python.org>
<http://bugs.python.org/i
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 locals
Steven D'Aprano added the comment:
On Fri, Jan 15, 2016 at 07:56:39AM +, poostenr wrote:
> As I did more testing I noticed that appending data to the file slowed
> down. The file grew initially with ~30-50KB increments and around
> 500KB it had slowed down to ~3-5KB/s, until a
Steven D'Aprano added the comment:
I cannot replicate that performance difference under Linux. There's a small
difference (about 0.1 second per million iterations, or a tenth of a
microsecond) on my computer, but I don't think that's meaningful:
py> from timeit import Timer
py&
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 calculator
Steven D'Aprano added the comment:
I'm sorry, I don't understand what you think is the bug here. It looks like you
are passing a corrupted file which has a PNG extension but is not actually a
PNG file (it contains PHP code). What do you expect should happen?
--
nosy: +steven.daprano
Steven D'Aprano added the comment:
I don't see any conclusive evidence that this is a bug in the Python
interpreter, so I'm going to close the issue.
Hana, if you are still having this problem, please join the main python mailing
list https://mail.python.org/mailman/listinfo/python-list
New submission from Steven D'Aprano:
There are a few operations such as summing or unpacking infinite iterators
where the interpreter can become unresponsive and ignore Ctrl-C
KeyboardInterrupt. Guido suggests that such places should occasionally check
for signals:
https://mail.python.org
Changes by Steven D'Aprano <steve+pyt...@pearwood.info>:
--
nosy: +steven.daprano
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python
Steven D'Aprano added the comment:
Looks good to me.
I've run some quick timing tests, and for very small lists, there's no
significant difference, but for larger lists I'm getting up to a 50% speedup.
Nicely done, thank you.
--
___
Python tracker
Steven D'Aprano added the comment:
This is the standard behaviour of closures in Python. It's annoying, and often
not what you expect, but it's not a bug.
Effectively, your dict or list contains five functions, each of which refer to
the same variable "t". By the time the loo
Steven D'Aprano added the comment:
Perhaps you could suggest a specific change to the docstrings for str.encode
and unicode.decode?
(BTW, I presume you are aware that the equivalent of (bytes)str.encode and
unicode.decode are gone in Python 3?)
--
nosy: +steven.daprano
New submission from Steven D'Aprano:
Add either a FAQ or a new page under "Meta Information" in the documentation
for how to formally cite Python in scientific papers or other academic
situations.
See thread on Python-Ideas here for justification and further discussi
Steven D'Aprano added the comment:
This is not a bug, but behaving correctly. You have:
py> A = np.random.random((10,1))
py> np.all(A)
True
py> np.all(A) < 1 # is True less than 1?
False
which is correct: True is *not* less than 1. But True *is* less than 2:
py> True < 2
Steven D'Aprano added the comment:
This was raised and rejected here:
http://bugs.python.org/issue24668
--
nosy: +steven.daprano
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/i
Changes by Steven D'Aprano <steve+pyt...@pearwood.info>:
--
nosy: +steven.daprano
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python
Steven D'Aprano added the comment:
On Fri, Apr 29, 2016 at 10:09:46AM +, DqASe wrote:
> Added file: http://bugs.python.org/file42649/x.py
Ah, I see! That makes sense now. Thanks.
Why don't you just set the initial state of the lists in the doctests?
That makes much better documentat
Steven D'Aprano added the comment:
I'm afraid I can't quite see what the problem is. If you're passing your own
globs argument, can't you deepcopy it yourself?
Could you show a minimal, short example demonstrating the issue please?
--
nosy: +steven.daprano
versions: +Python 3.6
Steven D'Aprano added the comment:
Ben, I'm sorry to see you have spent such a long time writing up reasons for
changing this behaviour. I fear this is a total waste of your time, and ours to
read it. Python 2.7 is under feature freeze, and changing the behaviour of
str.encode
Steven D'Aprano added the comment:
It looks like your Python 3 is somehow using your Python 2 site directory. What
does your PYTHONPATH contain?
Try running this:
python3 -E -S -c "import sys; print(sys.path)"
and see what it says.
--
nosy: +steven.daprano
type: crash -
Steven D'Aprano added the comment:
This issue seems to have lost momentum, I'd like to revive it by proposing a
slightly different interface for the autorange function.
Attached is a proof-of-concept patch. I've moved the code which determines the
number of loops out of the main function
Steven D'Aprano added the comment:
> I would suggest making the 0.2 tunable as an optional argument.
Sounds like a good idea to me.
> I also notice the repeat functionality isn't included in the patch, is there
> a reason?
I don't understand which repeat functionality you're
New submission from Steven D'Aprano:
(This is already done, but I should have added a ticket before committing the
new module.)
See PEP-0506.
--
assignee: steven.daprano
components: Library (Lib)
messages: 265288
nosy: steven.daprano
priority: normal
severity: normal
status: open
Changes by Steven D'Aprano <steve+pyt...@pearwood.info>:
--
resolution: -> fixed
stage: -> resolved
status: open -> closed
___
Python tracker <rep...@bugs.python.org>
<http://bu
Steven D'Aprano added the comment:
On Thu, May 12, 2016 at 04:49:59AM +, Nick Coghlan wrote:
> The embedded side-effects were my main concern with Scott's original
> patch, so Steven's callback-based approach strikes me as a definite
> improvement. However, the awkwardness of th
Steven D'Aprano added the comment:
I don't understand. The documentation clearly states:
"Python searches a standard list of directories to find one which the calling
user can create files in." How do you expect to be able to write files to a
directory that doesn't exist?
-
Steven D'Aprano added the comment:
To explain in more detail: ``type('s').startswith`` is the same as
``str.startswith``, which is an unbound method in Python 2 and a regular
function in Python 3. Either way, it expects *two* arguments: a string which
becomes "self", and a sec
Changes by Steven D'Aprano <steve+pyt...@pearwood.info>:
--
stage: patch review -> commit review
___
Python tracker <rep...@bugs.python.org>
<http://bugs.pyt
New submission from Steven D'Aprano:
The FAQs include a discussion of the rejected Pascal "with" statement
(different from the Python `with`). From time to time people propose variants
of it, such as using a leading dot to make it unambiguous.
Guido has just firmly rejected
Steven D'Aprano added the comment:
On snap! Nicely found! This seems to have something to do with the way
generator expressions are run inside their own scope.
In Python 2.7, a list comprehension in a class sees the locals correctly:
py> class K:
... a = 2; x = [a+i for i in ra
Steven D'Aprano added the comment:
Xiang Zhang is correct: the original is technically correct. If you read it
like this:
"All of Python’s immutable built-in objects are hashable, while no mutable
containers (such as lists or dictionaries) are [hashable]."
it should be clear. But i
Steven D'Aprano added the comment:
Thanks Ian! I can't believe I looked at that function earlier today and
couldn't see that!
--
nosy: +steven.daprano
stage: -> resolved
status: open -> closed
___
Python tracker <rep...@bugs.python.o
Steven D'Aprano added the comment:
On Sun, May 08, 2016 at 04:24:59AM +, Joshua Morton wrote:
> Following the comments in python ideas [1] [...]
>
> [1] https://mail.python.org/pipermail/python-ideas/2016-April/039469.html
Am I missing something? I don't see anything r
Steven D'Aprano added the comment:
In Python 3.x, 'a' is just as much a Unicode string as 'ä'. I agree that
binascii.a2b_hex should raise ValueError for argument 'ä', or ';' for that
matter, as they are invalid values. There's an inconsistency in why some
invalid characters raise ValueError
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 <rep...@bugs.python.org>
<http://bugs.python.org/i
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
whitespace
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, not a bug.
> and
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 {key: value}
calls
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 trailing sp
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 SPACE,
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:
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, copy
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.html
Steven D'Aprano added the comment:
Correction: `importlib.import_module` is also available in Python 2.7.
--
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/i
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 <rep...@bugs.python.org>
<http://bugs.python.org/i
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 analy
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
messages: 272638
nosy
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_Root
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-point rounding,
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 rounded) results
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.dapr
Changes by Steven D'Aprano <steve+pyt...@pearwood.info>:
--
resolution: -> fixed
stage: -> resolved
status: open -> closed
___
Python tracker <rep...@bugs.python.org>
<http://bu
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 having yet another branch
Changes by Steven D'Aprano <steve+pyt...@pearwood.info>:
Removed file: http://bugs.python.org/file43791/code.patch
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python
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
same prompts
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 <rep...@bugs.python.org>
<http://bugs.python.org/i
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
___
Python
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 unicode type
2
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 screen shot
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 <rep...@bu
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 do you mean
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 <rep...@bugs.python.org>
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 number exactly
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 <rep...@bugs.python.org>
<http://bugs.python.or
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 shot is more
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 nroot
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,
independ
Changes by Steven D'Aprano <steve+pyt...@pearwood.info>:
--
nosy: +steven.daprano
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python
Changes by Steven D'Aprano <steve+pyt...@pearwood.info>:
--
versions: +Python 3.7 -Python 3.3
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python
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
rejected
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 performance differe
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: open -&g
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.
Changes by Steven D'Aprano <steve+pyt...@pearwood.info>:
--
nosy: +steven.daprano
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python
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 views
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 sequence' or
> sequence
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 maybe
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 may hav
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]
optional
Changes by Steven D'Aprano <steve+pyt...@pearwood.info>:
Removed file: http://bugs.python.org/file46310/argparse_nobreak.py
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python
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 <rep...@bugs.python.org>
<http://bugs.p
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 text, and make
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 private
us
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" is
self-e
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 <rep...@bugs.python.org>
201 - 300 of 1436 matches
Mail list logo