Steven D'Aprano added the comment:
This is a bug tracker for issues with the Python language, interpreter and
standard library. For third party applications like pip, please report bugs to
their maintainers.
https://github.com/pypa/pip/issues
--
nosy: +steven.daprano
resolution
Steven D'Aprano added the comment:
This is a bug tracker for issues with the Python language, interpreter and
standard library. For third party applications like pip, please report bugs to
their maintainers.
https://github.com/pypa/pip/issues
--
nosy: +steven.daprano
resolution
Steven D'Aprano added the comment:
Converting *all* exceptions into RuntimeError is certainly not a good idea,
especially since you include KeyboardInterrupt and other non-errors.
I'm probably going to be on the losing side of this one (I lost the argument
back when a similar issue
New submission from Steven D'Aprano :
Sorry Yashwanthbarad, this isn't a bug, you expect the wrong result.
Augmented assignment for lists is documented to be the same as calling the
extend method, which means your AppenedFuncShortHandOperator function modifies
the argument list in-place
Steven D'Aprano added the comment:
The idiom of a module running doctests on itself when executed as a script is a
common idiom.
If modulegraph and pyinstaller can't cope a module importing another module
from inside an if statement, that's a bug in them, not in the heapq module (and
many
Steven D'Aprano added the comment:
In your first example, `min([(-5, 2), (0, 2)])` the min() function compares the
two tuples and finds that the first one is lexicographically smaller:
py> (-5, 2) < (0, 2)
True
so (-5, 2) is considered the minimum. In the second example,
Steven D'Aprano added the comment:
This is correct behaviour. What makes you think otherwise?
For future bug reports, please don't post screen shots of text, copy and paste
the text into the body of your bug report.
Posting screenshots makes it difficult for us to copy and run your code
Steven D'Aprano added the comment:
This is definitely cool though. It might make a really sweet example in the
demos that come with Python, or in the tutorial, showcasing both the
awesomeness of HelioViewer and how to use Python to connect to web APIs.
https://github.com/python/cpython/tree
Change by Steven D'Aprano :
--
resolution: -> not a bug
stage: -> resolved
status: open -> closed
title: Android Game -> SPAM
type: security ->
___
Python tracker
<https://bugs.pyt
Steven D'Aprano added the comment:
Just change the f string quotes.
Python strings, whether f-strings or not, can be delimited by '' or "" or
triple quotes. So this works:
>>> f"But, {'this quote is right.'}"
'But, this quote is right.'
Remember that the part
Steven D'Aprano added the comment:
If you change the starting point of the rounding away from zero, the bias flips
back and forth, which is exactly what I would expect from Banker's Rounding:
def check_bias(start):
d = 0.001
ne = no = 0
for i in range(1000
Steven D'Aprano added the comment:
Thank you for your long and detailed bug report, but please post one issue per
bug report.
Tim, we agree that the notion of significant figures is irrelevant; is Carlos'
even/odd test sufficiently flawed that we should close this bug report, or keep
Steven D'Aprano added the comment:
By the way, for future reports, it is much better to give the URL of the page
and copy and paste the exact quote than to give a screen shot. Using a screen
shot is inconvenient for us (we have to try to guess what URL you are referring
to, there are *lots
Steven D'Aprano added the comment:
"Class attribute" and "instance attribute" are the usual terms used in the
Python documentation and community. I have heard other terms used in other
language communities, in particular "members" and "variables", b
Steven D'Aprano added the comment:
Mike, the bug tracker is not a help-desk for questions. There are many other
forums where you can ask for help:
- the python-list and tutor mailing lists
https://www.python.org/community/lists/
- Stackoverflow
- The Python IRC channel https
Steven D'Aprano added the comment:
Further to what Mark said, I'm afraid you are mistaken when you thought that
"the result was correct" on R. R cheats by not printing the full precision of
the number, they just stop printing digits, giving a false impression of
accuracy. You
Steven D'Aprano added the comment:
On Mon, Jun 15, 2020 at 07:37:16PM +, mike stern wrote:
> sorry but I don't see the option to delete
Your keyboard has a Delete key and a Backspace key. Select the quoted
text in your email client and press one or the other.
If you can't see the quo
Steven D'Aprano added the comment:
> I wouldn't trust a language behaving crazy like this
I guess then you won't trust C, Java, C++, Swift, Javascript, Ruby, Cobol,
Fortran, and pretty much every programming language in existence. The only ones
that escape this are ones that don't h
Steven D'Aprano added the comment:
Alas, this gotcha is the consequence of the way `+=` is defined in Python.
Although the behaviour is surprising, there's nothing to fix because everything
is working as expected:
* addition to a list will extend the list, as expected;
* trying to assign
Steven D'Aprano added the comment:
This is working as designed. assertCountEqual is documented here:
https://docs.python.org/3/library/unittest.html#unittest.TestCase.assertCountEqual
It says: "Test that sequence *first* contains the same elements as *second*..."
notice that it t
Steven D'Aprano added the comment:
Wait, I'm sorry, do you mean this?
py> repr(r)[13:-16]
'?i)b((?:[a-z][w-]+:(?:/{1,3}|[a-z0-9%])|wwwd{0,3}[.]|[a-z0-9.-]+[.][a-z]{2,4}/)(?:[^s()<>]+|(([^s()<>]+|(([^s()<>]+)))*\\
Steven D'Aprano added the comment:
> notice the stripped characters in the `repr`
Er, no. Your regex looks like line noise, and it hurts my brain to look at it
:-)
If you have spotted a difference, can you tell us what characters are stripped?
When I try running it, I don't get
Steven D'Aprano added the comment:
You don't need `b = bytes([0x41, 0x0D, 0x0A])`, this will work just as well:
b = b'\x41\x0D\x0A'
and this is even better:
b = b'A\r\n'
> It seems like bytes.decode always replaces "\n" with "\r\n".
What makes you sa
Steven D'Aprano added the comment:
Thanks Raymond, that is the intended effect, and your analysis seems
plausible.
--
___
Python tracker
<https://bugs.python.org/issue40
Steven D'Aprano added the comment:
Typo:
"on each step, you delete one item from the from and step forward"
Should be, you delete one item from the FRONT and step forward.
--
___
Python tracker
<https://bugs.python.o
Steven D'Aprano added the comment:
Rémi is correct, this is not a bug.
The problem isn't with list.count. If you print list.count each time through
the loop, you will see that it is working perfectly.
The problem is that you are modifying the list as you are iterating over it.
That means
Steven D'Aprano added the comment:
On further thought, no, I don't think it would be a reasonable feature.
User opens the CSV file, probably using the default encoding (UTF-8?)
but potentially in anything.
They collect some data as bytes. Those bytes could be from any unknown
encoding. When
Steven D'Aprano added the comment:
The csv file object knows the encoding it was opened with, I think?
If so, we could add an enhancement that bytes objects are first decoded to str
using the same encoding the file was opened with. That seems like a reasonable
new feature to me.
Everything
Steven D'Aprano added the comment:
Works for me in 3.7. See attached file. Can you provide a minimal piece of code
that demonstrates the bug?
Since Python 3.5 is now only accepting security fixes, and numpy is a
third-party library, unless you can demonstrate this in a more recent version I
Change by Steven D'Aprano :
Added file: https://bugs.python.org/file49192/test_asserttrue.py
___
Python tracker
<https://bugs.python.org/issue40761>
___
___
Python-bug
Change by Steven D'Aprano :
Removed file: https://bugs.python.org/file49191/test_asserttrue.py
___
Python tracker
<https://bugs.python.org/issue40761>
___
___
Python-bug
Change by Steven D'Aprano :
--
Removed message: https://bugs.python.org/msg369846
___
Python tracker
<https://bugs.python.org/issue40761>
___
___
Python-bug
Steven D'Aprano added the comment:
Works for me in Python 3.7. See attached file.
Given that Python 3.5 is only longer accepting security fixes, and that numpy
is a third-party library, unless you can reproduce this in a more recent
version I think we should close this.
--
nosy
Steven D'Aprano added the comment:
On Fri, May 22, 2020 at 10:23:06AM +, Rémi Lapeyre wrote:
> As you said the PEP would have to explain why not just use sympy and
> honestly I don't have a very good argument there for now.
Because sympy is a beast. It's an excellent beast, b
Steven D'Aprano added the comment:
3.5 and 3.6 are now only accepting security fixes.
Only the stability of random.random is guaranteed across versions, but you are
calling randrange:
https://docs.python.org/3/library/random.html#notes-on-reproducibility
So I am pretty sure
Steven D'Aprano added the comment:
Hi Jacob, and welcome.
You said: "I was experimenting with nested dictionaries when I came across
strange behavior that I can not figure out at all."
This is a bug tracker, for reporting bugs, not a help desk for asking how to
figure ou
Steven D'Aprano added the comment:
> Perhaps you missed it because you're not in the CODEOWNERS so don't
> automatically get notified by GitHub?
That's quite possible. I can't fix that as Github considers everything
to do with my computer and browser too old. Until I can get a new
co
Steven D'Aprano added the comment:
*blink*
How did I miss this entire thing? Where was the code review?
Thanks Tal for shepherding this through, and thanks Tzanetos for caring
about the unit tests.
--
___
Python tracker
<https://bugs.python.
Change by Steven D'Aprano :
--
components: +Interpreter Core -ctypes
type: behavior -> enhancement
___
Python tracker
<https://bugs.python.org/issu
Steven D'Aprano added the comment:
Please re-upload the patch file as an uncompressed text file, as it is quite
difficult for many people to view zip files in their browser.
--
nosy: +steven.daprano
title: slice does not slice -> slice not hasha
Steven D'Aprano added the comment:
You have given no justification for removing item access for the fields except
"some users are still relying on ... access by item position and length".
Normally the fact that some people are doing this would be reason to reject
this
Steven D'Aprano added the comment:
This is a new feature, so it would have to go into 3.9, all older versions are
in feature-freeze.
--
versions: -Python 3.5, Python 3.6, Python 3.7, Python 3.8
___
Python tracker
<https://bugs.python.
Steven D'Aprano added the comment:
Python is a case-sensitive language. Why would case-insensitive completions be
useful?
--
nosy: +steven.daprano
___
Python tracker
<https://bugs.python.org/issue40
Steven D'Aprano added the comment:
What reason do you have to think that this is a Python issue rather than a
permissions error?
Since you haven't told us what permissions the file has, what OS you are using,
who set the permissions, or even the actual error message, it is impossible
Steven D'Aprano added the comment:
Speaking of OpenSSL, a few years ago this paper came out about OpenSSL's
vulnerability to adversarial composites. Quote:
"As examples of our findings, weare able to construct 2048-bit
composites that are declared prime with probability 1/16 byOpen
Steven D'Aprano added the comment:
Miller-Rabin is known to be deterministic for all N < 2**64 too.
To be pedantic, M-R is known to be deterministic if you check every
value up to sqrt(N), or possibly 2*log(N) if the generalized Riemann
hypothesis is true. The question is whet
Steven D'Aprano added the comment:
Hi,
The behaviour you are calling "gibbrish" is correct, as the expression
`(p-1)/2` calculates a 64-bit floating point number, which may lose
precision even for small values of p, but will definitely lose precision
for large p.
Ca
Steven D'Aprano added the comment:
Take your pick between either of these:
random.randrange(1, N)
random.randint(1, N-1)
https://docs.python.org/3/library/random.html#functions-for-integers
--
___
Python tracker
<https://bugs.python.
Steven D'Aprano added the comment:
What you are describing is not what we mean by a crash (a core dump or
segfault); it sounds like a regular Python exception.
Python 3.5 is obsolete and there are no more bug fixes for it except for
security fixes.
You have not given us enough information
Steven D'Aprano added the comment:
> independent class
Oops, sorry I mean independent implementation.
--
___
Python tracker
<https://bugs.python.org/issu
Steven D'Aprano added the comment:
I don't think this is needed in the builtin zip at all. I think that there is
no consensus on Python-Ideas that this is needed or desirable.
I especially don't think the API should be a keyword flag on zip. Flag
arguments which change the behaviour
Steven D'Aprano added the comment:
https://docs.python.org/3/reference/expressions.html#membership-test-operations
--
nosy: +steven.daprano
___
Python tracker
<https://bugs.python.org/issue40
Steven D'Aprano added the comment:
Sorry Massimo, there are no new features being added to 2.7, not even
critical security fixes. That's not my decision.
https://www.python.org/doc/sunset-python-2/
Python 2 is effectively now a dead project from the point of view of us
here at CPython
Steven D'Aprano added the comment:
This is a new feature and cannot be added to older versions which are in
feature-freeze.
Adding the feature to (say) Python 2.7.18 would be inconsistent, because it
wouldn't exist in 2.7.0 through .17. Likewise for all the other versions before
3.9
Steven D'Aprano added the comment:
By the way Filip, you were told on the Stackoverflow page that the output was
correct and that you were not using doctest correctly. Serhiy also hinted to
you that you should check the output in the REPL and you falsely claimed that
it gave the expected
Steven D'Aprano added the comment:
Have you tried calling multiline_output() in the REPL?
It does *not* show your expected output:
# expected
First line
Second line
but the string repr():
# actual
'First line\nSecond line\n'
Change your doctest to either
Steven D'Aprano added the comment:
Would we be willing to consider an enhancement to have complex numbers always
display using float format rather than ints?
1+1j --> 1.0+1.0j
We could still suppress an unsigned real zero:
1j --> 1.0j
but negative zero would show:
Steven D'Aprano added the comment:
This feature is already provided by just supplying a `__missing__` dunder:
py> class MyDict(dict):
... def __missing__(self, key):
... return "The key is {}".format(key)
...
py> d = MyDict()
py> d[1234]
'The key is
Steven D'Aprano added the comment:
> Since the original report was about 2.7 which is no longer maintained,
> I propose to close this issue as outdated.
For what it's worth, I'm okay with closing.
--
___
Python tracker
<https://bugs.p
Steven D'Aprano added the comment:
Rémi, it is not true that the Decimal module won't lose precision. It will.
Decimal is not exact either, it is still a floating point format similar to
float.
py> Decimal(1)/3*3
Decimal('0.')
The two major advantages of Deci
Steven D'Aprano added the comment:
I think the error messages could be improved.
In the first example: `f,x, a, b = [1,2,3]`
you are unpacking three values, but you need to unpack 4. The error message is
not very helpful: 5 values is "more than 3" but it would be too many
Steven D'Aprano added the comment:
I think you may have misread the documentation. It says:
"an OS-level handle to an open file"
which is what you call a file descriptor. Not a file object, which is what you
get by calling the builtin `open`, but a file handle like you get fr
Steven D'Aprano added the comment:
Oh never mind, I'm just going to slink away now and stop posting corrections
when distracted...
--
___
Python tracker
<https://bugs.python.org/issue40
Steven D'Aprano added the comment:
Oops, that should be
... ``x == x``, ``3 < x``, and ``x > 3`` are all false ...
--
___
Python tracker
<https://bugs.python.org/i
Steven D'Aprano added the comment:
How about this?
"The not-a-number values ``float('NaN')`` and ``decimal.Decimal('NaN')`` are
special. Not-a-number values always compare unordered and unequal to any other
value, including themselves. For example, if ``x = float('NaN')``, then ``x
Steven D'Aprano added the comment:
> the program is supposed to draw a function like y=sin(x) but is drawing
> y=abs(sin(x)).
It would have been nice if you had described the problem this way from your
initial bug report, instead of saying that the turtle was moving backwards. I
unde
Change by Steven D'Aprano :
--
resolution: -> not a bug
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Steven D'Aprano added the comment:
Try changing the turtle to the arrow pointer and see if you can still see
backwards movement.
james.shape('arrow')
--
___
Python tracker
<https://bugs.python.org/issue40
Steven D'Aprano added the comment:
Perhaps this is just my old eyes, but I can't see where the turtle is going
backwards. I can see it spinning, but it's not clear that the turtle position
is moving backwards or if it is an illusion caused by the turtle spinning
around.
If your eyes
Steven D'Aprano added the comment:
On Sat, Mar 21, 2020 at 01:30:13PM +, Julin wrote:
> Why do you think it makes the code less clear, though?
Classes that inherit from object, and those which don't ("classic
classes") behave differently in Python 2. But in Python 3, they a
Steven D'Aprano added the comment:
Ross:
"implement this logic for a limited range of non-negative n, imposing an upper
limit (suggestions welcome) to make sure all provided input can be safely
processed. We can then build from there to support larger n going forward if
the demand i
Steven D'Aprano added the comment:
I don't know... To my mind, if we are going to support working with primes, the
minimum API is:
- is_prime(n)
- next_prime(n)
- prev_prime(n)
- factorise(n)
- generate_primes(start=0)
(I trust the names are self-explanatory.)
There are various other
Steven D'Aprano added the comment:
Code churn for no good reason is not a good idea. I cannot think of any good
reasons to change this:
- it doesn't add new functionality;
- it doesn't fix bugs;
- it doesn't make the code easier to maintain;
- it makes the code LESS clear instead of more
Steven D'Aprano added the comment:
That's not a bug. The in-place addition `+=` for lists is equivalent to the
extend method. See the documentation:
https://docs.python.org/3/library/stdtypes.html#mutable-sequence-types
and the tutorial:
https://docs.python.org/3/tutorial
Steven D'Aprano added the comment:
To be clear, are you only making a copy of the unchanged object if it is a
mutable bytearray, not str or bytes?
--
nosy: +steven.daprano
___
Python tracker
<https://bugs.python.org/issue39
Change by Steven D'Aprano :
--
resolution: -> third party
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Steven D'Aprano added the comment:
What does it mean for two Bytecode objects to be equal?
I know what equality means for ints: they have the same numeric value.
I know what equality means for strings: they have the same sequence of Unicode
code points.
I have no concept of what it would
Change by Steven D'Aprano :
--
resolution: -> not a bug
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Steven D'Aprano added the comment:
This is a numpy issue, you will need to report it to the numpy developers. But
first you need to check that it really is a bug. What makes you think it is a
bug? In your example, index 3 looks out of bounds to me. Remember that indexes
start at 0, not 1
Steven D'Aprano added the comment:
Ah, I see now. I was using an older version of Python and the output of
dis was different. It didn't recurse in to show the disassembly of the
code object as well.
> The first block of instructions here are for the def statement, and
> the second
Steven D'Aprano added the comment:
I think this is sufficient for a shallow copy.
import copy
import types
def copyfunction(func):
new = types.FunctionType(
func.__code__,
func.__globals__,
func.__name__,
func.__defaults__,
func
Steven D'Aprano added the comment:
> BTW how else are methods/functions are created in Python except via def?
Functions are objects like everything else in Python, so they have a
type, which has a constructor:
from types import FunctionType
The documentation for FunctionType is a
New submission from Steven D'Aprano :
Function objects are mutable, so I expected that a copy of a function should be
an actual independent copy. But it isn't.
py> from copy import copy
py> a = lambda: 1
py> b = copy(a)
py> a is b
True
This burned me whe
Steven D'Aprano added the comment:
> Integers are implicitly converted to floats in operations with floats.
> How can this change break old code?
# Status quo
print(1e60 + 1)
=> prints 1e+60
# In the future:
=> prints 100
Steven D'Aprano added the comment:
> would it not be better to for dis.dis to behave consistently for methods and
> source strings of methods
I don't think so. The inputs are different. One is a string containing a `def`
statement, which is an executable statement. The other is a fu
Steven D'Aprano added the comment:
I agree with both Eric and Zachary, but I just wanted to point out that in a
Python interpreter with a keyhole optimizer, you can expect that expressions
like `1*10**9` to be a constant:
# Python 3.5
py> from dis import dis
py> dis('1*10**9
Steven D'Aprano added the comment:
Regarding performance, on my computer, the overhead of calling tuple() on a
list comp ranges from about 30% for tiny sequences down to about 5% for largish
sequences.
Tiny sequences are fast either way:
[steve@ando cpython]$ ./python -m timeit "[i
Steven D'Aprano added the comment:
This was discussed on Python-Ideas:
https://mail.python.org/archives/list/python-id...@python.org/message/LSGZF3G4RFVTKXB5Y2EW5USL2JANG5RS/
and on Discuss:
https://discuss.python.org/t/why-no-tuple-comprehension/2820/1
In both cases the consensus
Change by Steven D'Aprano :
--
nosy: +steven.daprano
___
Python tracker
<https://bugs.python.org/issue1207613>
___
___
Python-bugs-list mailing list
Unsubscribe:
Steven D'Aprano added the comment:
You're right that it's hard to find any documentation on package `__main__.py`
files. There's nothing here that I can see:
https://docs.python.org/3/reference/import.html#packages
Aside from the tutorial, the only other place I can find it referenced
Steven D'Aprano added the comment:
This behaviour is shared by all programming languages that use floating point
numbers. For example, this is Ruby:
[steve@ando ~]$ irb
irb(main):001:0> 10 * 3.14 == 31.4
=> false
irb(main):002:0> 10 * 3.14 - 31.4
=> 3.55271
Steven D'Aprano added the comment:
This is a floating point issue, not a bug. Floats inherently only have a
limited precision available, so they are not always the exact number you think
they are.
Using 1e9 forces the result to be a float, which introduces rounding errors
Steven D'Aprano added the comment:
[Bruce]
> but try this, and it will NOT work:
>
> FatThing= [(5, 4, "First Place"),
>(6, 6, "Fifer Place"),
>(2, 2, "Slowr Place")]
> print(FatThing) #this works
>
> FFThing
Steven D'Aprano added the comment:
> The concatenation of two tuples into a third tuple, using the + command,
> causes an error if every member of each of the two tuples is NOT a string!
Works for me:
py> ("Hello", 1, None) + (23, 19.5, "Goodbye")
Steven D'Aprano added the comment:
> Shouldn't that say that "'environ' is not a package" instead?
No. The os module is special, so I'll talk about the usual case first.
Normally, for `import spam.eggs` to succeed, *spam* has to be a package, and
*eggs* has to be either a sub-
Change by Steven D'Aprano :
--
nosy: +rhettinger
___
Python tracker
<https://bugs.python.org/issue39634>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Steven D'Aprano :
--
assignee: -> docs@python
components: +Documentation -Library (Lib)
nosy: +docs@python
title: Add clarification in documentation for incorrect heapq heapify naming ->
Add clarification in documentation for heapq.heapify naming
type: -> en
Steven D'Aprano added the comment:
The "-ify" or "-fy" suffix in English means "to make". For example, "amplify",
"magnify", "terrify", etc.
https://en.wiktionary.org/wiki/-ify
So heapify literally means "make int
Steven D'Aprano added the comment:
Sorry everyone, due to technology problems I am unable to comment on the
github page, and due to ISP problems I've been off the internet for a
few days.
> pull_request: https://github.com/python/cpython/pull/18401
[Serhiy]
> Is not "or both&quo
Steven D'Aprano added the comment:
This has been discussed not long ago, it seems like it will need a PEP. See
Brett's comment:
https://mail.python.org/archives/list/python-...@python.org/message/BDK6BDBOG2462SJIIOC5QMYPAJ5A4523/
and various discussions:
https://mail.python.org/archives
401 - 500 of 1436 matches
Mail list logo