Steven D'Aprano added the comment:
(Previously posted on Python-Dev.)
I think the documentation note is a good idea.
But I disagree with deprecating "cmd" unless it is actively falling
apart and no longer working, not just languishing with no feature
improvements. Just in the
Steven D'Aprano added the comment:
Possibly you may not be familiar with interval notation?
https://www.mathsisfun.com/sets/intervals.html
Since this is Python and not maths, maybe we should rethink the wording.
--
___
Python tracker
&
Steven D'Aprano added the comment:
This is not a bug, it is intentional.
In Python 2, numbers with a leading zero are interpreted as octal, leading to
surprising results:
py> 015
13
In Python 3, we use 0o15 to get octal, and 015 becomes a syntax error.
--
nosy: +steven
New submission from Steven D'Aprano :
The Python 2.x syntax for octal integers is a syntax error in 3.x, but the
error message is very uninformative:
SyntaxError: invalid token
Can this be improved? Perhaps to something like:
invalid token, use 0o prefix for octal integers
(see
Change by Steven D'Aprano :
--
type: behavior -> enhancement
___
Python tracker
<https://bugs.python.org/issue33305>
___
___
Python-bugs-list mailing li
Steven D'Aprano added the comment:
I've opened an issue to improve the error message: #33305
--
___
Python tracker
<https://bugs.python.org/issue33304>
___
__
Steven D'Aprano added the comment:
In Python 2, you have to override __getslice__ as well as __getitem__.
Try this instead:
class MyTuple(tuple):
def __getitem__(self, pos):
print "get item {}".format(pos)
return super(MyTuple, self).__getitem__(pos)
d
Steven D'Aprano added the comment:
the argument to string.strip (also lstrip and rstrip) is not an exact substring
to remove, but a set of characters to remove:
py> 'zyxzz1234'.strip('xyz')
'1234'
--
nosy: +steven.daprano
resolution: -> n
Steven D'Aprano added the comment:
I agree with Tim that this is likely to be the difference between Python 2
truncating division and Python 3 division.
For the record, I get the following results:
9997809507L Python 2.7
9997809307.0 Python 3.5
9997809307 R
9997809307 Javascript (
Steven D'Aprano added the comment:
> Even Ruby gets the right answer (9997809507) for that :-)
Oops, I forgot to say... Ruby 1.8 also does truncating division like Python 2.
--
___
Python tracker
<https://bugs.python.org
Steven D'Aprano added the comment:
Ah sheesh I copied and pasted the wrong bits. After the division terms go to
zero, you get
-590072-200112-18-18-18-18-18-18-18-18+9998599835
which goes to 9997809507 as calculated by Ruby and Python 2, and I promise
that's the end of me replying
Steven D'Aprano added the comment:
Precedence issues when dealing with units is unavoidable, I think. The units
program on Linux/Unix has similar issues, and they write their own parser and
choose their own precedence.
https://www.gnu.org/software/units/manual/html_node/Operators.htm
Steven D'Aprano added the comment:
Strings in Python 3 are already unicode.
Looking at the patch, I see a lot of fractions which display as the missing
glyph white square. For example, instead of seeing 1/9, which displays
perfectly everywhere, I see a mysterious box similar to □.
Even
Steven D'Aprano added the comment:
Hi Braiden, and welcome!
I see that the ticket has already been closed, but another note for the future:
please don't paste screenshots of your code, copy and paste the relevant source
code. We don't edit code with Photoshop, and posting
Steven D'Aprano added the comment:
Hello Quentin, and welcome.
Please don't post screen shots of text. We don't edit our code with Photoshop,
and using a screenshot makes it difficult to copy your code for testing, to
verify the bug report, and prevents the blind and visuall
Steven D'Aprano added the comment:
Joe, we have no idea what you think is the bug.
It is intentional that the second argument for range is excluded. This is
called an "half-open" range, and it helps avoid off-by-one and signpost errors.
Your comments about break, continue and
Steven D'Aprano added the comment:
I've always expected that documentation for a module can assume that the module
itself, and/or the function being described, has been imported.
On the other hand, I have no objection to making this explicit, especially in
the recipes section wher
Steven D'Aprano added the comment:
How does the performance change with this patch?
Quick-select is a nice idea in theory, but unless it is written in C, it is
unlikely to beat sorting the list unless you have HUGE data sets. Its been
nearly four years since I last did some benchmarks
New submission from Steven D'Aprano :
As mentioned on the Python-List:
https://mail.python.org/pipermail/python-list/2018-May/733061.html
random.choices() silently returns the wrong values when cumulative weights are
not given, i.e. if the user misreads the documentation and provides
Steven D'Aprano added the comment:
On Mon, May 14, 2018 at 11:54:32AM +, Paul Moore wrote:
> Requiring a pre-check on cum_weights (for example, the obvious check
> that the sequence is nondecreasing) would add an O(n) step, and so
> significantly impact performance for t
Change by Steven D'Aprano :
--
nosy: +steven.daprano
___
Python tracker
<https://bugs.python.org/issue33501>
___
___
Python-bugs-list mailing list
Unsubscr
Steven Warwick added the comment:
you probably have already considered this, but I just wanted to ask if it might
be worth considering turning the problem "upside down" to make things easier.
I'm interpreting the problem that there are variables we'd like to add to the
Steven Warwick added the comment:
sorry, I meant the following:
logger.info( " {:s} {:s} ".format(logger.name, logger.module ) )
or
logger.info( f" {logger.name:s} {logger.module:s} " )
this could be supported with full backward compatibility with very little
effo
New submission from steven Michalske :
We are using some compiled cython modules with c++ 11 features.
This prohibits us from instructing users to install python from the python.org
download.
Please consider using clang with support for C++ 11 and higher.
This would move the minimum OS X
steven Michalske added the comment:
This might be a cython issue then, but I will dig into an example case. Please
be patient.
--
___
Python tracker
<https://bugs.python.org/issue31
Change by Steven D'Aprano :
--
nosy: +steven.daprano
___
Python tracker
<https://bugs.python.org/issue31757>
___
___
Python-bugs-list mailing list
Unsubscr
New submission from Steven Barker :
While investigating a Stack Overflow question (here:
https://stackoverflow.com/q/46529767/1405065), I found that there may be a race
condition in the cleanup code for concurrent.futures.ThreadPoolIterator. The
behavior in normal situations is fairly benign
Steven D'Aprano added the comment:
What are you claiming is the bug? I don't understand what you think the problem
is.
Don't dump a large script in our laps and expect us to get a Google API key to
run it. Forget that, it isn't going to happen. Simplify your code t
Steven D'Aprano added the comment:
Oops, accidentally messed up the status. Fixing now.
Francesco, if you simplify your code and come back with a detailed description
of what you think the bug is, then we will investigate.
--
nosy: +eric.smith
resolution: -> not a b
Steven D'Aprano added the comment:
Python 2.7 is in feature freeze, so 3.7 is the absolute earliest this could be
introduced. Given how close we are to 3.7 feature freeze, 3.8 is more likely.
I don't think we would have any objections to supporting hijri calendar, in
principle
Steven D'Aprano added the comment:
Thank you for taking the time to report what you thought was a bug, but your
example is way too complicated for a bug report. We shouldn't have to study
your entire program to understand what the problem is.
I can see at least one bug in
Change by Steven D'Aprano :
--
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.org/issue31915>
___
___
Python-bugs-
Change by Steven Loria :
--
pull_requests: +4237
___
Python tracker
<https://bugs.python.org/issue30806>
___
___
Python-bugs-list mailing list
Unsubscribe:
Steven D'Aprano added the comment:
Thank you for the bug report Ronan, but I'm afraid that I have no idea what you
think the problematic behaviour is. I'm not going to spend the time installing
the third-party hypothesis module, and learning how to use it, just to decipher
yo
Steven D'Aprano added the comment:
I don't have Python 3.7 available to me, but in 3.5 the behaviour of
u.startswith(v) with an empty v seems consistent to me:
py> "alpha".startswith("", 20, 30)
True
py> "alpha"[20:30].startswith(""
Steven D'Aprano added the comment:
I don't understand why you think they are the wrong values. What values were
you expecting?
You have a byte array, you set the value to the byte b's', which is 115, and
you get 115. You have a (byte) character array, you set the va
New submission from Steven D'Aprano :
multiprocessing.Array slice assignment claims to require a single character
even if it requires more than one:
py> arr = multiprocessing.Array('c', 3)
py> arr[:] = b'xyz' # works
py> arr[:] = 'xyz'
Traceback (m
Change by Steven D'Aprano :
--
title: mutliprocessing.Array misleading error message in slice assignment ->
multiprocessing.Array misleading error message in slice assignment
___
Python tracker
<https://bugs.python.org
New submission from Steven D'Aprano :
multiprocessing.Array is documented as taking the same character codes as
array.array, but it also takes 'c' which is not documented.
https://docs.python.org/3/library/multiprocessing.html#multiprocessing.Array
https://docs.python.org/3/lib
Steven D'Aprano added the comment:
That's not a bug. That's because the file object does have an encoding
attribute, which is set to None.
getattr only returns the default when the attribute doesn't exist, not if it
exists but is None.
--
nosy: +steven.daprano
r
Steven D'Aprano added the comment:
Not every trivial one-liner needs to be in the standard library. In this case,
there are two easy (and obvious) ways to do it:
sum(1 for x in iterator)
len(list(iterator))
(The first probably saves memory; the second probably is faster.)
Given how ra
Steven D'Aprano added the comment:
I'm sorry, I have no idea how to read an Anaconda notebook file. In the browser
it looks like some sort of nested dictionary. I can find the code:
j = [1, 2, 3, 4]
k = [5, 6, 7, 8]
z = zip(j, k)
for x, y in z:
for m, n in z:
print (
Steven D'Aprano added the comment:
I decided to run the code in 3.5 and 2.7, and now that I know what I'm looking
for, I can see the results buried in the Anaconda notebook.
This is not a bug, zip has been changed in Python 3 to return an iterator
instead of a list. To get the sa
Steven D'Aprano added the comment:
I agree with Camion that the error message is misleading, and not just for
beginners. It threw me for a loop too, when I first read it.
Serhiy is right, the exception type cannot and should not be changed, but we
can change the error message. I'm
Steven D'Aprano added the comment:
On Sun, Dec 10, 2017 at 09:15:16AM +, Serhiy Storchaka wrote:
> My point is that the current error message is correct and is not misleading.
With respect Serhiy, in this bug report you have TWO PEOPLE who have
said that it is misleading in this
Steven D'Aprano added the comment:
On Sun, Dec 10, 2017 at 10:00:27AM +, Camion wrote:
> Understanding that, I suggest to simply add "(expected 'tuple')" at the end
> of the message.
> ex : TypeError: 'int' object is not iterable (expected
Steven D'Aprano added the comment:
Python 2.7 is in feature freeze, so this can only go into 3.7.
I would find this useful, and would like this feature. However, I'm concerned
by your comment that you fall back on creating a normalized copy and comparing.
That could be expe
Steven D'Aprano added the comment:
Please don't report three issues under one ticket, unless they are so closely
related that they cannot be separated.
I don't understand what your second issue actually is. You refer to the docs
that specify extended syntax as [start:stop:ste
New submission from Steven D'Aprano :
Looking at issue 32288, I realised that the glossary doesn't define "extended
slicing" or "extended slice", even though they are common terms. Although I
thought I know what they meant, on closer reflection I realised I wasn&
Steven D'Aprano added the comment:
The given version is correct: the comma is only required if the initializer is
given. Your suggested version
typecode, [initializer]
implies that the comma is always required whether the initializer is given or
not.
If we want to be absol
New submission from Steven D'Aprano :
The functools module imports reduce from _functools, using a guard in case it
is not present:
try:
from _functools import reduce
except ImportError:
pass
However, the documentation says nothing about reduce being optional, and
New submission from Steven D'Aprano :
If you ask for help on the set operators ^ & and | then help docs only talk
about them as bitwise operators.
Since sets and frozensets are important, built-in types, the help should
mention them as well.
--
assignee: docs@python
c
New submission from Steven D'Aprano :
The obvious documentation for locals() fails to mention that when called from
the top level of a module (outside of a function or class body) it returns the
same dict as globals().
https://docs.python.org/2/library/functions.html#l
Steven D'Aprano added the comment:
In British, Australian, New Zealander, and Indian English (and sometimes
Canada), at least, "bracket" on its own typically means round brackets () and
is rarely if ever used for square brackets [] or curly brackets {} without the
adjective.
New submission from Steven D'Aprano :
What do you mean by "string wrapped integers", and how should it support them?
--
nosy: +steven.daprano
___
Python tracker
<https://bugs.pyt
Steven D'Aprano added the comment:
> Values like "1", "2", "3", should be supported.
You mean you want to call parser.add_argument('--foo', nargs="2")
instead of parser.add_argument('--foo', nargs=2)?
Why?
--
Steven D'Aprano added the comment:
It isn't clear to me what bug you are reporting here:
- What do you mean by "problem reading back from a list of lists"? What sort of
problem?
- What makes you think that there is a bug in the interpreter, rather than in
your own code?
Steven D'Aprano added the comment:
Here's a simple demonstration of the issue:
# --- cut %< ---
import doctest
def hash_files():
"""
>>> hash_files() # doctest: +ELLIPSIS
...
d41d8cd98f00b204e9800998ecf8427e _
Steven D'Aprano added the comment:
Oops, somehow managed to accidentally unsubscribe r.david.murray
--
nosy: +r.david.murray
___
Python tracker
<https://bugs.python.org/is
Steven D'Aprano added the comment:
Tim Peters said:
> Right, "..." immediately after a ">>>" line is taken to indicate a code
> continuation line, and there's no way to stop that short of rewriting the
> parser.
I haven't gone through t
Steven D'Aprano added the comment:
That is nearly two hundred lines of quite complex code. What results are you
expecting and what results are you getting?
I've just tried running it under Python 3.3 and 3.5 on a RedHat-based Linux,
and after generating a large amount of output (27
Steven D'Aprano added the comment:
Oh, by the way... are you aware that the Recursor class defines a class
attribute `branches` which is shared by all instances? You create multiple
recursor objects, but they all share the same `branches` attribute. That might
be intentional, but i
New submission from Steven Vascellaro :
In Python 3.6, converting an xml `xml.etree.ElementTree.Element` to a string is
done using `xml.etree.ElementTree.tostring()`.
```
from xml.etree import ElementTree
xml = ElementTree.Element('Person', Name='John')
print(Elem
Steven Vascellaro added the comment:
Alternatively, the most intuitive solution would be to give `Element` an
explicit `__str__` method.
The current behavior of `str(Element)` is to return the object's location in
memory.
```
from xml.etree import ElementTree
xml = ElementTree.El
Steven D'Aprano added the comment:
Also note that shadowing builtins *deliberately* is a powerful and useful
technique used for advanced programming.
--
nosy: +steven.daprano
___
Python tracker
<https://bugs.python.org/is
Steven D'Aprano added the comment:
For ordinal scales, you should use either median_low or median_high.
I don't think the standard median function ought to choose for you whether to
take the low or high median. It is better to be explicit about which you want,
by calling th
Steven D'Aprano added the comment:
By the way, this isn't a crash (that's for things which cause the interpreter
to segfault). I'm marking this as Not a bug, but I'm open to suggestions to
improve either the documentation or the median functions.
--
resol
Steven D'Aprano added the comment:
Unless I've mucked it up, I just committed your patch on Github so I'm closing
this ticket. Thanks.
--
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bu
Steven D'Aprano added the comment:
What do you think of adding a note in the documentation for median?
"If your data is ordinal (supports order operations) but not numeric (doesn't
support addition), you should use ``median_low`` or ``median
Steven D'Aprano added the comment:
This does seem to be a normalisation issue:
py> unicodedata.normalize('NFKC', 'ϵαγϕ') == ''.join(func.__code__.co_varnames)
True
so I'm closing this as not a bug.
Mike, thank you for copying and pasting the relevan
Steven D'Aprano added the comment:
This is not a bug, it is the documented behaviour: the * operator does not copy
the lists, it duplicates references to the same list. There's even a FAQ for it:
https://docs.python.org/3/faq/programming.html#how-do-i-create-a-multidimens
Steven D'Aprano added the comment:
Nathan, the bug tracker is not the place to debate Python behaviour. For
the purposes of the bug tracker, all we need say is that it is
documented behaviour and not a bug. If you want to change that
behaviour, there is a process to follow, and asking s
Steven D'Aprano added the comment:
This is standard behaviour for all iterators. Once you have iterated over them
once, they are consumed, and iterating over them again returns nothing:
py> it = iter("abc")
py> print(list(it))
['a', 'b',
Steven D'Aprano added the comment:
I'm sorry, it isn't clear what optimizations for float(X) and int(X) you are
referring to.
I can only guess that you want to optimize:
float(0)
to use LOAD_CONST 0.0 instead of calling the float() function. If that is what
you want, w
Steven D'Aprano added the comment:
ID numbers in Python are only guaranteed to be unique for the lifespan of the
object. In CPython they can be re-used. (In other implementations, like Jython
and IronPython, IDs are allocated as sequential numbers and won't be reused.)
The othe
New submission from Steven D'Aprano :
There is a loophole in the Unicode normalisation which allows the creation of
names matching keywords.
class Spam:
locals()['if'] = 1
Spam.𝐢𝐟# U+1D422 U+1D41F
# returns 1
Those two characters are 'MATHEMATICAL BOLD SMALL
Steven D'Aprano added the comment:
Possibly the correct term is canonicalisation rather than normalisation,
although I think the two are interchangeable.
--
___
Python tracker
<https://bugs.python.org/is
Steven D'Aprano added the comment:
Sorry, this tracker is for the interpreter and standard library. For bugs in
third party code like numpy and pandas, you will have to report it on their own
bug trackers.
--
nosy: +steven.daprano
resolution: -> third party
stage: -&g
Change by Steven D'Aprano :
--
nosy: +steven.daprano
___
Python tracker
<https://bugs.python.org/issue33721>
___
___
Python-bugs-list mailing list
Unsubscr
Steven D'Aprano added the comment:
I think you have misunderstood where and when default arguments are assigned.
When you call func() with no arguments, kwargs is empty, and it is correct that
the output will be
-> Decorator:
In the following line, you call the original fun
Steven D'Aprano added the comment:
Perhaps a little less self-righteous anger and a little more detail on this
alleged bug would be appropriate.
Quote:
I still think it's ridiculous that every item added to that dict has an
"extra", non-obvious reference count t
Steven D'Aprano added the comment:
I decided to risk this "catastrophic" leak, and ran this:
py> x = leaks()
py> x
((2, 3), , 24)
py> import gc
py> gc.collect()
22
py> x
((2, 3), , 24)
so I think Eric is correct, it is just a garbage collection issue. Po
Steven D'Aprano added the comment:
Both names "v1" and "v2" refer to the same object. Python does not make copies
of objects on assignment, so if you write:
a = []
b = a
then a and b both refer to the same list object, and the names "a" and "b&quo
New submission from Steven D'Aprano :
What do you mean "type help"?
help() is added by the site module, if you've done something to skip running
the site module it won't be added.
Can you give an example of what you are trying to do, what happens and what you
expe
Steven D'Aprano added the comment:
Eric wrote:
> I don't know of any OS that supports NULs in filenames
HFS, HFS Plus, and Apple File System all support NULs in filenames.
HFS Plus volumes include a special special directory called the metadata
directory, in the volume
Steven D'Aprano added the comment:
Eryk Sun says:
> It has to be a ValueError since the error is an invalid parameter at the
> Python level.
How does the first follow from the second?
Strings with NULs in them aren't errors or invalid parameters at the Python
level, and the
Steven D'Aprano added the comment:
Please don't post screenshots of text, they make it difficult for the blind and
visually impaired to contribute. Instead, please copy and paste the error
message into the body of your bug report. (Which I see you have done, which
makes the
Steven D'Aprano added the comment:
Terry asked:
> I have a question about Linux consoles. [...] Does a Linux console retrieve
> all 5 at once, as IDLE does?
Not typically. Like the Windows console, Linux consoles are also line-oriented,
and hitting up-arrow cycles through each l
Steven D'Aprano added the comment:
I'm curious how you are getting f-strings (introduced in Python 3.6) in Python
2 code that you are passing to 2to3.
--
nosy: +steven.daprano
___
Python tracker
<https://bugs.python.o
Steven D'Aprano added the comment:
> @Steven lib2to3 is no longer specifically for python 2 code, it also
> parses python 3 code
Ah, all good then. Thanks.
--
___
Python tracker
<https://bugs.python.
Steven D'Aprano added the comment:
"I have a really hard time believing that [...] others haven't noticed this
rather glaring flaw in the code."
*shrug* Easy or hard for you to believe, nevertheless this same quote-unquote
"flaw" goes back to Python 1.5 or
Steven D'Aprano added the comment:
Sorry, this is for reporting bugs in the Python interpreter and standard
library, not your own code. If you have a bug in your pyinator project, you
should report it to yourself, not us :-)
If you think my analysis of the problem below is wrong, and
Steven D'Aprano added the comment:
I don't think the description you give is very accurate. The description in the
file splat.py says:
"Hangs/core dumps Python2 when instantiated"
(which is it? hang or core dump?)
but I can't replicate that. Instantiating A() i
Change by Steven D'Aprano :
--
resolution: -> not a bug
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.pyth
New submission from Steven Silvester :
When writing an `async` function, we often want to `await` a method call that
may or may not be `async`. For instance, it may be synchronous in the base
class, but asynchronous in the subclass on the instance we have been given. It
would be nice for
Steven Silvester added the comment:
Thanks for your consideration and for implementing the original feature!
--
___
Python tracker
<https://bugs.python.org/issue34
Steven D'Aprano added the comment:
You wrote:
> There are 6 bytes not 4 and where did the c3, bd, and c2 come from?
In Python 2, strings are byte strings, in Python 3, strings by default are
Unicode text strings. You are seeing the UTF-8 representation of the text
string.
py>
Change by Steven D'Aprano :
--
nosy: +steven.daprano
___
Python tracker
<https://bugs.python.org/issue34483>
___
___
Python-bugs-list mailing list
Unsubscr
Steven D'Aprano added the comment:
This exception goes back to at least Python 2.6 (if not older) but I'm not
convinced it is a bug.
Calling __new__ alone is not guaranteed to initialise a new instance
completely. The public API for creating an instance is to call the class obje
Steven D'Aprano added the comment:
_struct is a private implementation detail. You shouldn't use it. You shouldn't
care where the implementation "really is" in your Python code, because it could
move without warning. There are no backwards-compatibility guarantees
1201 - 1300 of 1942 matches
Mail list logo