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 Barker added the comment:
Yes, this looks to be a duplicate of that issue. I'm closing this issue as a
duplicate, but I don't seem to be able to set the Superseder field. If you can,
please set that to Issue 2786.
--
resolution: -> duplicate
status: o
Steven Barker added the comment:
A few weeks ago I reported issue 27389 which looks to be a duplicate of this
issue. Has any progress been made on this issue?
--
nosy: +Steven.Barker
___
Python tracker
<http://bugs.python.org/issue2
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
Steven D'Aprano added the comment:
This has been really eye-opening, and I just wanted to drop you a note
that I am watching this thread carefully. My first priority is to get
the tests all passing before beta 1 on 2016-09-12, even if (as seems
likely) that means weakening the tests, and
Steven D'Aprano added the comment:
> I do think that the documentation could be a lot clearer.
Which specific documentation are you referring to? The "What's New" document
from 3.0? That's a historical document, a snapshot of the past.
If you have a concern abo
Steven D'Aprano added the comment:
I'm not able to test the patch at the moment, but since it essentially just
uses the recipe in the docs, I expect it will have the same side-effect.
Namely, it prevents you using the tab key to indent in the interactive
interpreter.
Now I don
New submission from Steven Barker:
While investigating a Stack Overflow question
(http://stackoverflow.com/questions/16484764/multiprocessing-value-clear-syntax)
I came across a misleading error message from the multiprocessing.Value
constructor:
>>> import multiprocessing
>>
Changes by Steven Barker :
--
components: +ctypes -Library (Lib)
___
Python tracker
<http://bugs.python.org/issue17991>
___
___
Python-bugs-list mailing list
Unsub
Changes by Steven D'Aprano :
--
nosy: +steven.daprano
___
Python tracker
<http://bugs.python.org/issue23017>
___
___
Python-bugs-list mailing list
Unsubscr
Steven D'Aprano added the comment:
Even though I agree with closing this issue, there is some support for ignoring
certain "missing values" when calculating min() and max(). The draft 2008
revision of IEEE-754 includes two functions maxNum and minNum which silently
skip ov
Steven D'Aprano added the comment:
This is a bug tracker for issues in the Python language and standard library,
not a service for learning how to program using Python.
If you have an actual bug to report, you should give more detail including the
actual code you used, the result you exp
Steven D'Aprano added the comment:
Mark Dickson wrote:
> I've talked to Mike Cowlishaw (the author of the specification)
> about this particular issue, and the spec is not likely to
> change on this point.
I'm curious about the rationale for the decision. As I'm s
Steven D'Aprano added the comment:
This is already a FAQ:
https://docs.python.org/2/faq/programming.html#how-do-i-create-a-multidimensional-list
I guess this bites every beginning Python programmer, but it's a natural, and
desirable, consequence of Python's object model an
Steven Barker added the comment:
This issue is a special case of the problem discussed in issue 992389, that
modules within packages are not added to the package dictionary until they are
fully loaded, which breaks circular imports in the form "from package import
module".
The co
Steven D'Aprano added the comment:
Thanks for the note Mark. I need to give Oscar's comments some careful and
distraction-free thought, but off the top of my head I think Oscar's suggestion
to require consistent types seems reasonable, except that mixing int with any
other
Steven D'Aprano added the comment:
This has come up on Python-Ideas again:
http://permalink.gmane.org/gmane.comp.python.ideas/32002
https://mail.python.org/pipermail/python-ideas/2015-February/032000.html
--
nosy: +steven.daprano
___
Python tr
New submission from Steven Barker:
The documentation for the csv.writer.writerows method says that it expects "a
list of row objects", when it really will accept any iterable that yields rows
(such as a generator). While it's often nice for code to be more accepting than
Steven Barker added the comment:
Another Stack Overflow user pointed out that the DictWriter's writerows
implementation (in pure Python) unnecessarily converts whatever its argument is
into a list in memory before passing it on to the builtin writer.writerows
method which would accep
Steven D'Aprano added the comment:
I'm with Serhiy, I don't think we need a "literal", just make slice itself
indexable:
reverse = slice(None, None, -1)
reverse = slice[::-1]
The only question in my mind is what slice should do when given just a single
index:
slice[
Steven D'Aprano added the comment:
The behaviour is correct, this is not a bug. Each time you pop from aa, the
following items move down one space. Then, the next time you pop, the items
have moved:
['a0', 'b1', 'c2', 'd3', 'e4',
Changes by Steven D'Aprano :
--
nosy: +steven.daprano
___
Python tracker
<http://bugs.python.org/issue19915>
___
___
Python-bugs-list mailing list
Unsubscr
Changes by Steven D'Aprano :
--
nosy: +steven.daprano
___
Python tracker
<http://bugs.python.org/issue18814>
___
___
Python-bugs-list mailing list
Unsubscr
Steven D'Aprano added the comment:
I've found the same behaviour going back to Python 1.5.
I think what happens here is that (0+∞j)*1 evaluates the multiplication by
implicitly coercing the int to a complex:
(0+∞j)*(1+0j)
=> (0*1 + ∞j*1 + 0*0j + ∞j*0j)
=>
Steven D'Aprano added the comment:
I disagree that it "should not be the case", I think Python's current behaviour
is correct. Although it makes debugging completer functions harder, it would
not be good for a bug in the completer to raise an exception and break line
editi
Steven D'Aprano added the comment:
It already does:
"The form using a tuple, isinstance(x, (A, B, ...)), is a shortcut
for isinstance(x, A) or isinstance(x, B) or ... (etc.)."
If it were "all", it would use "and", not "or".
I don't think any
Steven D'Aprano added the comment:
On Fri, Jun 26, 2015 at 09:20:18PM +, Terry J. Reedy wrote:
> I agree that the tuple explanation if ok. But "Return whether an
> object is an instance of a class or of a subclass thereof." (3.5)
> seems wrong. I believe 'su
Steven D'Aprano added the comment:
I don't think that this behaviour is desirable, certainly not by default. If I
write "{1} {0}".format('one') that's clearly a programming error and I should
get an exception. Chaining a second .format method call afterwar
Steven D'Aprano added the comment:
Your example of int(0.5) returning 1 is misleading, because
0.999...95 is already 1.0. (1.0 - 1/2**53) = 0. is the nearest
float distinguishable from 1.0.
It seems to me that either random() may return 1.0 exactly (alt
Steven D'Aprano added the comment:
Closing. If anyone thinks the docs aren't clear enough, and has an alternate
version they would like to suggest, you can re-open it.
--
resolution: -> rejected
status: open -> closed
___
Pytho
Steven D'Aprano added the comment:
On Thu, Jul 02, 2015 at 04:05:45AM +, Tim Peters wrote:
> Very surprising! Which platform & Python is that?
Python 2.7.2 (default, May 18 2012, 18:25:10)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-52)] on linux2
I get the same result on Python 2.6
Steven D'Aprano added the comment:
I don't know, what *is* the problem? What behaviour did you expect? The code
sample you show seems to be working exactly as it is supposed to.
b'\x00\x00 0' is the same as b'\x00\x00\x20\x30', and that is the same as
b'\x2
Steven D'Aprano added the comment:
On Thu, Jul 02, 2015 at 05:35:53PM +, Tim Peters wrote:
> Steven, there's something wrong with the arithmetic on your machine,
> but I can't guess what from here (perhaps you have a non-standard
> rounding mode enabled, pe
Steven D'Aprano added the comment:
I've been running this snippet for almost 72 hours now:
s = u"БГДЖИЛЦЫЭu042eЯАВЕКМРТu042312456789"
while True:
state = random.getstate()
try:
a = random.choice(s)
except IndexError:
break
with no results yet. I
New submission from Steven D'Aprano:
While investigating issue 24546, I discovered that at least some versions of
Python on 32-bit Linux have a double-rounding bug in multiplication which may
lead to an unexpected IndexError in random.choice.
See http://bugs.python.org/issue2454
Steven D'Aprano added the comment:
I've created a new issue 24567 for the double-rounding bug. I have taken the
liberty of copying the nosy list from this issue to the new one, apologies if
that is inappropriate.
--
assignee: -&g
Steven D'Aprano added the comment:
Bytes in Python 3 do use ASCII representation:
py> b'\x41' == b'A' # ASCII
True
If you think the documentation is unclear, please tell us which part of the
docs you read (provide a URL) and we wi
Steven D'Aprano added the comment:
I'm sorry, but I believe that you have misunderstood what happens here.
This has nothing to do with the hex codec, or int.to_bytes() etc. This
is the standard property of byte strings in Python, that they are
displayed using ASCII as much as poss
Steven D'Aprano added the comment:
On Fri, Jul 10, 2015 at 02:18:33AM +, Gregory P. Smith wrote:
> for bytes, \v (0x0b) is not considered a line break. for unicode, it is.
[...]
> I think these should be consistent.
I'm not sure that they should. Unicode includes other l
Steven D'Aprano added the comment:
On Sat, Jul 11, 2015 at 03:23:53PM +, candide wrote:
>
> New submission from candide:
>
> Expressions such as
>
> a + not b
> a * not b
> + not b
> - not b
>
> raise a SyntaxError, for instance :
>
>
> &g
Steven D'Aprano added the comment:
On Mon, Jul 13, 2015 at 01:37:26AM +, Neil Girdhar wrote:
>
> New submission from Neil Girdhar:
>
> In the description of the consume recipe:
[...]
> iterator should be replaced with iterable. This function accepts strings for
>
New submission from Steven D'Aprano:
As discussed on the python-ideas list here:
Subject: Disallow "0" as a synonym for "0"
https://mail.python.org/pipermail/python-ideas/2015-July/034631.html
and on Stackoverflow, leading zeroes are forbidden for ints, due to the
Steven Barker added the comment:
I've finally gotten around to looking into this issue and it turns out that
fixing "from package import *" to work with circular imports is pretty easy, as
all that needs to be done is apply the same logic from the patch for issue
17636 to the l
Steven Barker added the comment:
I was looking over some of the bugs I've contributed to, and it looks like this
one has been fixed. It should be marked as a dupe of issue 22161 and closed (I
can close, but not set a superseder, it seems).
--
resolution: -> duplicate
stat
Steven D'Aprano added the comment:
I wonder if it is a left-over from the behaviour prior to 3.2? In 3.1, I
get this syntax error:
py> def outer():
... spam = 1
... def inner():
... nonlocal spam
... del spam
... inner()
...
SyntaxError: can no
Steven D'Aprano added the comment:
Sounds patronizing.
Whether used for beginners to programming or experts, IDLE (or any other
application) should start with sensible defaults. As much as possible, it
should usefully start without requiring extra configuration. But beyond that,
act
Steven D'Aprano added the comment:
Unfortunately, this fails because there is no way to tell how long an arbitrary
iterable is, or whether it is reentrant or not. Consider:
def gen():
while True:
if random.random() < 0.5:
return random.random()
Not only i
Steven D'Aprano added the comment:
On Wed, Aug 12, 2015 at 09:23:26PM +, flying sheep wrote:
> Python has iterators and iterables. iterators are non-reentrant
> iterables: once they are exhausted, they are useless.
Correct.
> But there are also iterables that create
Steven D'Aprano added the comment:
Which note are you referring to? There are at least two mentioned in
this thread, the FAQ and a footnote in the docs for stdtypes.
If you're referring to the table of operations just below these:
https://docs.python.org/2/library/stdtypes.html#sequ
Steven Barker added the comment:
I've managed to partially fix my build environment, so I can verify that my
patch (attached previously) works as intended. I'm not completely sure that it
doesn't break unrelated things as my build still has lots of failing tests
(which a
Steven D'Aprano added the comment:
Bar, thanks for the time you put into diagnosing this error, it is
definitely a bug. The intention is for mean([huge, huge]) to return
huge, not raise OverflowError.
I'm reluctant to say that mean() will *never* raise OverflowError, but
it
Steven D'Aprano added the comment:
On Sun, Sep 27, 2015 at 04:17:45PM +, R. David Murray wrote:
>
> I also want "detect if there are any surrogates".
I think that's useful enough it should be a str method. Here's a
pure-Python implementation:
def is_surr
Steven D'Aprano added the comment:
Not a bug. You have used a generator expression, so it is exhausted once
you have run over it once using list(). Then, you run over it again with
any() and all(), but they don't see any values so return the default
value.
Change the generator exp
Steven Barker added the comment:
Thanks for looking at the issue Brett.
I think you're right that your patch has incorrect semantics, since it doesn't
save the value to the provided namespace if it had to go through the special
path to find the name. I think my patch got that
Steven D'Aprano added the comment:
On Sat, Oct 10, 2015 at 04:28:22PM +, Bar Harel wrote:
> Any comments on the patch?
Not yet, I've been unable to look at it, but thank you. If I haven't
responded by the 17th of this month, pl
Changes by Steven D'Aprano :
--
assignee: -> steven.daprano
___
Python tracker
<http://bugs.python.org/issue25177>
___
___
Python-bugs-list mailing li
Changes by Steven D'Aprano :
--
assignee: -> steven.daprano
___
Python tracker
<http://bugs.python.org/issue20499>
___
___
Python-bugs-list mailing li
Steven D'Aprano added the comment:
I'm not entirely satisfied that the way it is calculated by C++11/C99 is
correct. (Although I can see the appeal of the C version.) Mathematically,
complex multiplication (a+bj)*x should be identical to (a+bj)*(x+0j), but
obviously in the presen
Steven D'Aprano added the comment:
__builtins__ is a private implementation detail in CPython. There is no
guarantees made about whether it exists or not. E.g. it doesn't exist in Jython.
steve@orac:~/python$ jython
Jython 2.5.1+ (Release_2_5_1, Aug 4 2010, 07:18:19)
[OpenJDK Serv
Changes by Steven D'Aprano :
--
nosy: +terry.reedy
___
Python tracker
<http://bugs.python.org/issue25564>
___
___
Python-bugs-list mailing list
Unsubscr
Steven D'Aprano added the comment:
Has anyone confirmed that this bug actually exists? I'm afraid that I cannot
verify it. I get these results on three different computers:
py> x = 8.988465674311579e+307
py> statistics.mean([x, x])
8.988465674311579e+307
py> statistics.mea
Steven D'Aprano added the comment:
> Has anyone confirmed that this bug actually exists?
Confirmed. The initial report is not quite correct: you need three
values to trigger the overflow, not two:
py> x = 8.988465674311579e+307
py> statistics.mean([x]*2) == x
True
py> stat
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 D'Aprano added the comment:
On Mon, Nov 23, 2015 at 09:48:46PM +, STINNER Victor wrote:
> * the string has a cached UTF-8 byte string (ex: int(s) was called before the
> resize)
Why do strings cache their UTF-8 encoding?
I presume that some of Python's internals r
Steven D'Aprano added the comment:
Larry,
Is it too late to get this into 3.5rc1?
changeset 99407:ed45a09e5a69
Thanks.
--
nosy: +larry
___
Python tracker
<http://bugs.python.org/is
Steven D'Aprano added the comment:
On Wed, Dec 23, 2015 at 03:18:28PM +, Serhiy Storchaka wrote:
> May be implement the as_integer_ratio() method and/or numerator and
> denominator attributes in the Decimal class?
That would also be good as it will decrease the API differen
Steven D'Aprano added the comment:
doctest doesn't crash -- it is a regular exception, not a crash. "Crash" means
"Hard crashes of the Python interpreter – possibly with a core dump or a
Windows error box." In other words, a segmentation fault or other low-level
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
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
1701 - 1800 of 1942 matches
Mail list logo