Steven D'Aprano added the comment:
# True
data.find('a', 0)
That will return 0, not True.
# False
data.find('a', start=0)
And that will raise TypeError, not return False.
What exactly are you reporting here? I have read your bug report, and looked at
the screen
Steven D'Aprano added the comment:
Hi Richard,
> Also, using _asdict() seems strange as an exposed API, since it's an
> underscore method and users hence might not be inclined to use it.
I don't consider this a strong argument. Named tuple in general has to use a
Steven D'Aprano added the comment:
Are you the owner of imaplib2?
If so, you need to ensure that there are no licencing or copyright issues
preventing imaplib2 being transferred into the stdlib. That may (or may not)
require you to get agreement from any contributors to the library.
Steven D'Aprano added the comment:
On Sat, Dec 26, 2020 at 02:19:55AM +, Terry J. Reedy wrote:
> "Enhancements" (non-bugfix feature changes) can only be applied to
> future versions. However, you are asking for the reversion of an
> intentional feature change ma
Steven D'Aprano added the comment:
On Fri, Dec 25, 2020 at 01:31:51PM +, 施文峰 wrote:
> first test have a problem,you didn’t use r+ mode
I did, I copied your `test()` function exactly, however I did make a
mistake. I tried again with this:
>>> with open(FILE_PATH, 'r
Steven D'Aprano added the comment:
You say:
> after process python3 test_case.py
> json file's content like this
>
> @@{"how_dare_you": "how_dare_you"}
I cannot replicate that result.
I created a "data.json" with the followi
Steven D'Aprano added the comment:
Okay, I'm satisfied with that reasoning, thanks Raymond.
Patch looks good to me. Go for it!
Have a good Christmas and stay safe.
--
___
Python tracker
<https://bugs.python.o
Steven D'Aprano added the comment:
I like the addition but I'm not sure why you removed the price-earnings ratio
example from the docs. I think that it's useful to have an example that shows
that harmonic mean is not *just* for speed-related problems.
I'm not going t
Steven D'Aprano added the comment:
They don't do the same thing.
The dict comprehension requires a single key:value pair per loop. It
accumulates values into a single dict. Try this:
d = {}
for key, value in items:
print(id(d))
d[key] = value
The ID does
Steven D'Aprano added the comment:
On Mon, Dec 21, 2020 at 09:11:48PM +, Samuel Marks wrote:
> There were only 12k occurrences, I'm sure I could manually go through that
> in an afternoon. Would you accept it then?
Assuming "an afternoon" is half a work d
Steven D'Aprano added the comment:
It is probably harmless to enable the option, especially if it will be
the SQLite default, but why would you do your maths computations in sql,
using the limited set of functions available, when you could do them in
Python, with a much larger s
Steven D'Aprano added the comment:
By the way, it is almost always wrong to write "k for k in iterable" when you
can just write "iterable" or "list(iterable)".
Here are some micro-benchmarks:
[steve ~]$ python3.9 -m timeit -s "from string im
Steven D'Aprano added the comment:
As far as I can tell, every one of those are already available in Python.
https://docs.python.org/3/library/math.html
--
nosy: +steven.daprano
___
Python tracker
<https://bugs.python.org/is
Steven D'Aprano added the comment:
Sorry Raymond, I missed this before closing the task.
> FWIW, Allen Downey also had concerns about this wording.
I don't recognise the name, who is Allen Downey and what concerns does
he have?
--
_
Change by Steven D'Aprano :
--
resolution: -> rejected
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.pyth
Steven D'Aprano added the comment:
I'm willing to give Irit and Jake opportunity to make their case.
Particularly if they can demonstrate that I got my facts wrong.
I'm going to close the ticket, but if anyone feels strongly enough to
respond with a good argument, or better
Steven D'Aprano added the comment:
I'm pretty sure this is not a bug, but is working as designed.
The interpreter normalises unicode identifiers, but key lookup in the dict does
not.
Sorry, I don't have time right now to give a more detailed answer, but there
are two distinc
Steven D'Aprano added the comment:
I strongly oppose this change, and I dispute the characterisation of
this as a misleading note. It is not misleading, and I argue that every
word of it is factually correct. Jake, if you disagree, then please
provide some citations.
Irit: it is ridic
Steven D'Aprano added the comment:
> There is also the os.system() function which exposes the libc system()
> function. Should we deprecate this one as well?
Please don't deprecate os.system. For quick and dirty scripts used in trusted
environments with trusted data, it
Steven D'Aprano added the comment:
> Additionally, it suffers from the same issue as
> sitecustomize. It is a single file that won't be a real substitute for
> code execution in pth files.
I thought that the consensus in b.p.o. #33944 is that code execution in
pth files
Steven D'Aprano added the comment:
Hello valeriymartsyshyn,
This is for reporting bugs in the Python interpreter, it is not a help desk for
learning how to program in Python. There are many places you can ask for help
to debug your code, such as Reddit's r/learnpython, or Stackov
Steven D'Aprano added the comment:
Shouldn't this be discussed on Python-Ideas? I'm pretty sure this is a big
enough change that it will need a PEP.
If you need code run on startup, can't you just put it in the PYTHONSTARTUP
file?
--
n
Steven D'Aprano added the comment:
> @ Steven, did you mean to un-nosy Pratik?
No. I have tried to re-add him, but I think that because his user name
is all digits, the bug tracker won't accept it.
When I try, I get this error:
Edit Error: user has no
Steven D'Aprano added the comment:
The position of the caret assumes that every character in the string takes up
the same width, measured in pixels. That is only true for monospaced fonts like
Courier.
The only way to position the caret precisely with a proportional-width font i
Steven D'Aprano added the comment:
In addition, you are probably hitting normalization issues. There are two ways
to get the Cyrillic character 'й' in your string, one of them is a single code
point, the other is two code points:
>>> a = 'й'
>>>
Steven D'Aprano added the comment:
You are comparing the name with the file extension against the name without the
file extension:
>>> "Файл на български.ldr" == "Файл на български"
False
--
nosy: +steven.daprano
Steven D'Aprano added the comment:
"Maybe a helpful tip can be added to the error message."
What sort of helpful tip do you have in mind?
Remember that the error doesn't occur when the file is opened, but some time
later.
--
n
Steven D'Aprano added the comment:
The class you have provided is awkward to use, random access is inefficient, it
is not compatible with lists or offer a sequence API, it's not subscriptable or
iterable, the API exposes an unnecessary "Proxy" class, and the API is mor
Steven D'Aprano added the comment:
Code is working correctly, not a bug. Perhaps you are mistaking `continue` for
`break`.
Kshitish, we keep telling you not to use the bug tracker as a help desk. This
is now your eighth "bug report" that was 100% your misunderstanding. There
Steven D'Aprano added the comment:
This would be a classic example of the "Flag argument" anti-pattern:
https://www.martinfowler.com/bliki/FlagArgument.html
--
nosy: +steven.daprano
___
Python tracker
<https://bugs.pyt
Steven D'Aprano added the comment:
As a new feature, this could only go into 3.10, 3.9 is in feature freeze.
The requirements are unclear, it could mean any of:
- the file's *owner* has the execute bit set;
- the file's mode has any execute bit set;
- the *current us
Steven D'Aprano added the comment:
Hi Sébastien,
This is a bug tracker for reporting bugs, not a help desk to help with your
code. There are many community resources to help you debug your code, but this
is not one of them. You can try:
* Reddit's /r/learnpython
* the Python-li
Steven D'Aprano added the comment:
Nishant Gautam does not understand not condition.
This is your sixth incorrect bug report in a row. Please stop. This is not a
help desk to correct your mistakes.
a == 10 and (b != (not(11))) and b == a
--> True and (b != False) and True
--> Tr
Steven D'Aprano added the comment:
The ^ operator is bitwise-xor (exclusive-or), not exponentiation.
Stop wasting our time by posting false bug reports. This is now your fifth
incorrect bug report in a row. Once or twice can be forgiven that you didn't
know better.
Please stop
Steven D'Aprano added the comment:
Re-adding older versions.
--
versions: +Python 3.8, Python 3.9
___
Python tracker
<https://bugs.python.org/is
Steven D'Aprano added the comment:
This would be a change of behaviour, and 3.8 and 3.9 are in feature freeze, so
we could only add it in 3.10.
You say:
"it's supposed to capture the output without holding references to real things"
Is this requirement documented some
Steven D'Aprano added the comment:
Correct output.
https://docs.python.org/3/reference/expressions.html#operator-precedence
a = 10
b = 10
(a >= 10) and not (b == 10) | 7+2 == 9
returns False because of operator precedence. It evaluates like this:
(a >= 10) and not (b == 10)
Steven D'Aprano added the comment:
That is the correct output.
Kshitish, Python is a mature language (about 30 years old) used by tens or
hundreds of thousands of people every day. Did you believe that you were the
only person who noticed that Python cannot even run `if...else` state
Steven D'Aprano added the comment:
You can learn more about unicode and encodings:
https://www.joelonsoftware.com/2003/10/08/the-absolute-minimum-every-software-developer-absolutely-positively-must-know-about-unicode-and-character-sets-no-excuses/
https://pyvideo.org/pycon-us-2012/prag
Steven D'Aprano added the comment:
Why do you care what the implementation of the private methods are? Does it
make them faster or fix a bug? How is it "convenient" to change the
implementation to ternary if?
Without some better justification, this strikes me as just co
Steven D'Aprano added the comment:
A string prefix would be a large language change that would need to go through
Python-Ideas, a PEP and Steering Council approval. Let's not go there :-)
A new string method is a comparatively small new feature that probably won't
need a
Steven D'Aprano added the comment:
This is standard Windows behaviour, and goes back to DOS days. Reserved
filenames and illegal characters are described here:
https://docs.microsoft.com/en-gb/windows/win32/fileio/naming-a-file?redirectedfrom=MSDN
If the Windows OS and file system doe
Steven D'Aprano added the comment:
This is not a bug, it is normal handling of `and` and `or` operators since
Python 1.5 and possibly older.
The `and` and `or` operators are *short-cut* operators. This is intentional
design, so we can write things like:
if mylist and mylist[0] ==
Steven D'Aprano added the comment:
Hi Rose, this is a FAQ:
https://docs.python.org/3/faq/programming.html#why-are-default-values-shared-between-objects
although it's also a feature that does cause beginners some trouble, see for
example my comment here for more informati
Steven D'Aprano added the comment:
As Larry said, yes, this is expected behaviour, and has nothing to do with the
for loop. The purpose of defaultdict is that dict lookups create the entry if
it doesn't exist:
>>> from collections import defaultdict
>>> d = defa
Steven D'Aprano added the comment:
On Tue, Nov 10, 2020 at 09:55:40AM +, Serhiy Storchaka wrote:
> If clockwise is a new
> standard for this command in modern Turtle implementation, we can add
> yet one alias. Otherwise I agree with Raymond.
I had a very quick loo
Steven D'Aprano added the comment:
As a new feature, it can only go into 3.10. All other versions have reached
feature-freeze and can accept no new features.
We might argue that rotations should have always been written as
"anticlockwise" and "clockwise", but they
Steven D'Aprano added the comment:
Works for me:
>>> chr(1839)+'1'
'ܯ1'
You are mixing a right-to-left code point (DHALATH) with a left-to-right code
point (digit 1). The result depends on the quality of your console or terminal.
Try using a different ter
Steven D'Aprano added the comment:
PEP 594 is a draft, it has not been accepted. It is premature to start
cancelling perfectly good modules and breaking people's code.
https://conroy.org/breaking-python-packages
If you have some concrete reason for removing the binhex module,
Steven D'Aprano added the comment:
See also my comment here:
https://bugs.python.org/msg361451
--
___
Python tracker
<https://bugs.python.org/is
Steven D'Aprano added the comment:
Sorry, this is not a bug, but working as designed. Default values for functions
and methods are only created once, when the function is created, not on every
call.
This is a FAQ:
https://docs.python.org/3/faq/programming.html#why-are-default-values-s
Steven D'Aprano added the comment:
This is not a bug. The sequence repetition operator does not *copy* items, as
explained here:
https://docs.python.org/3/library/stdtypes.html#common-sequence-operations
--
nosy: +steven.daprano
resolution: -> not a bug
stage: -> reso
Steven D'Aprano added the comment:
See:
#26789 #39513
Serhiy, is a test case still needed? Should this be closed and pushed back to
fixing logging?
--
nosy: +steven.daprano
___
Python tracker
<https://bugs.python.org/is
Steven D'Aprano added the comment:
It looks like Python is correct and the other languages may be just truncating
the output.
In the Lua interpreter:
> =277*0.1
27.7
> = 277*0.1 == 27.7
false
Perl:
$ perl -e "use feature qw(say); say 277*0.1"
27.7
$ perl -e "us
Steven D'Aprano added the comment:
Eric I would normally agree with you but the only thing which gives me pause is
the statement that this doesn't occur with C, Lua and Perl.
That alone doesn't mean much. Different interpreters can use different
algorithms for printing
Steven D'Aprano added the comment:
3.9 and older are all in feature freeze, so no changes in behaviour will be
considered for them.
I'm afraid I cannot replicate the behaviour you describe. When I try, the full
warning message is correctly displayed. See the attached file.
Im
Steven D'Aprano added the comment:
Hi CaptainMitsumoto,
Did you follow the instructions given by the installer to read the log file? We
don't have access to your log file, only you do. Can you see what file cannot
be found?
Did you try some basic googling? I'm not a Windows
Change by Steven D'Aprano :
--
components: +Installation -Unicode
type: crash -> behavior
___
Python tracker
<https://bugs.python.org/issue42074>
___
_
Change by Steven D'Aprano :
--
title: f***ing setup failed is driving me insane -> setup error on windows
___
Python tracker
<https://bugs.python.org
Steven D'Aprano added the comment:
On Wed, Oct 14, 2020 at 12:45:55AM +, Damian Yurzola wrote:
> And you also see people doing date math on datetime.date.today which
> will result in different answers through out the day.
Yes? Is this a problem? If I ask the question &quo
Steven D'Aprano added the comment:
This is not a bug. In Python 2, zip() returns a list, so you can use it over
and over again. But in Python 3, zip() returns an iterator, and you can only
use iterators once. After you have used the iterator, it is exhausted and there
is nothing left
Steven D'Aprano added the comment:
Please don't post screen shots of text when you can post a direct link to the
page.
Are you talking about this?
https://docs.python.org/3/c-api/arg.html?highlight=py_cleanup#other-objects
This is a bug tracker, for reporting bugs in the Python i
Steven D'Aprano added the comment:
Oh no, you have discovered our dirty secret! Python is racist against Russia!
/sarcasm
Python is created by volunteers, including the documentation. If you want a
Russian translation, feel free to start working on one.
You could start here:
Steven D'Aprano added the comment:
Hi Leonard,
Any number which has only fixed precision will experience similar
issues. It might affect different calculations.
In Python, float, complex and Decimal have fixed precision, so they can
experience this issue.
But for simple calcula
Steven D'Aprano added the comment:
Some further resources:
https://stackoverflow.com/questions/8215437/floating-point-accuracy-in-python
https://stackoverflow.com/questions/21895756/why-are-floating-point-numbers-inaccurate
https://stackoverflow.com/questions/1089018/why-cant-de
Steven D'Aprano added the comment:
Please forgive me if my answer is a little bit brusque, but we get essentially
this same bug report regularly, only the numbers are different.
This is not a bug in Python, it is an unavoidable consequence of how floating
point arithmetic works in
Steven D'Aprano added the comment:
On Thu, Oct 01, 2020 at 04:37:28PM +, Damian Yurzola wrote:
> I was inspired to file this bug after reading through a multiplicity
> of bugs introduced by folks confused by the library's behavior.
Are these public bug reports or private
Steven D'Aprano added the comment:
Even if I agreed that this method "makes no sense", and I don't, removing it
would be gratuitous breakage.
Why should we break potentially thousands of people's code who are happily
using this method, merely because you say that pe
Steven D'Aprano added the comment:
Matt, you can add this to your own unit tests by just subclassing
unittest.TestCase and adding a new assertDuration method. Copy the existing
method's implementations (its open source and you should have the source code
already, but if not you c
Steven D'Aprano added the comment:
I think Eric left the issue open because he was hoping to update the FAQs
and/or docs with information about this issue.
I will leave it to someone else to decide whether or not to reopen it.
--
___
P
Steven D'Aprano added the comment:
You say:
"output should be empty list"
but that's not actually correct. You intend the output to be the empty list,
but if you think carefully about what happens during iteration, you should see
that the behaviour is correct.
To m
Steven D'Aprano added the comment:
This is not a bug, it is working as designed. Importing takes the module from
the cache. You can either delete the module from the cache:
del sys.modules['modulename']
import modulename # reloads from the module file
or possib
Steven D'Aprano added the comment:
On Tue, Sep 08, 2020 at 06:23:58PM +, David Williams wrote:
> Steven, it sounds like we agree to the change proposal, which is to
> remove gendered language from the documentation.
What?
Did you even read w
Steven D'Aprano added the comment:
Hello David,
I really don't think you speak for the entire LGBTQ community. You don't speak
for me or my wife.
You mention two issues here:
"First is that break and continue don't allow the programmer to do anything,
they cause
Steven D'Aprano added the comment:
Marco, sum should be as fast as possible, so we don't want to type check every
single element. But if it is easy enough, it might be worth checking the first
element, and if it fails, report:
cannot add 'type' to start value
wher
Steven D'Aprano added the comment:
As Marco says, the exception message is because the default value for start is
0, and you can't concatenate strings to the integer 0.
You get the same error if you try to concatenate lists:
py> sum([[], []])
TypeError: unsupported o
Steven D'Aprano added the comment:
Generating a range of equally-spaced floats is tricky and the range builtin is
not the right solution for this.
For numerical work, we often need to specify the number of steps, not the step
size. For instance, in numeric integration, we often li
Steven D'Aprano added the comment:
See the FAQ:
https://docs.python.org/3/faq/design.html#why-can-t-raw-strings-r-strings-end-with-a-backslash
Also documented here:
https://docs.python.org/dev/reference/lexical_analysis.html#string-and-bytes-literals
Previous issues: #1271 and #
Steven D'Aprano added the comment:
You can't end a string with a bare backslash, not even an raw string.
--
nosy: +steven.daprano
resolution: -> not a bug
stage: -> resolved
status: open -> closed
___
Python tracker
<h
Steven D'Aprano added the comment:
I agree with xtreak. I guess you probably misspelled the initial word:
>>> 'Python'[2:5] # same as the tutorial
'tho'
>>> 'Pyhton'[2:5] # misspelling
'hto'
--
nosy: +steven.daprano
Steven D'Aprano added the comment:
Here's another example:
py> set([1, 2**63, 4, -5, 6, 5])
{1, 9223372036854775808, 4, 6, 5, -5}
By the way, in the future, please don't post screen shots of text, copy the
code and output and paste it as text into your bug report. S
Steven D'Aprano added the comment:
"Unordered" means that the language doesn't promise any specific order, it
doesn't mean that there is no order at all.
Try strings:
py> set("abcdef")
{'b', 'f', 'c', 'e', &
Steven D'Aprano added the comment:
I don't think that Python, a computer language, IS an approach to OOP. A
programming language HAS an approach to OOP.
We would say "Python's approach to OOP is ..." so the approach is something
that belongs to Python, it isn
Steven D'Aprano added the comment:
Okay Marco, I'm changing the title to reflect the new API (support for rounding
modes rather than new round functions) and pushed the version to 3.10, since
3.9 is in feature freeze (no new features).
This will probably need to be discussed on Py
Steven D'Aprano added the comment:
One issue per ticket please.
Versions 3.9 and older are all in feature freeze, they will not get new
features.
Combining a global declaration with an assignment has been requested before,
and rejected. If you want to discuss that feature again, you s
Steven D'Aprano added the comment:
Marco, it is better to give a description of the functionality required rather
than a simplistic and incorrect implementation :-)
(Not that I am likely to provide a better implementation without a lot of
study.)
Regardless of whether you or I agree
Steven D'Aprano added the comment:
Vedran: you are quoting von Neumann out of context, he was talking about
generating random numbers, not rounding, and in the seven decades since he made
his famous witticism, we of course know that there is absolutely nothing wrong
with generating r
Steven D'Aprano added the comment:
If you know about timeit, why aren't you using it?
In any case, I have just ran your nested_lists.py file, and on my
computer, the last version with zip is the fastest version:
0 transpose1_0(lT) Time = 1.0627508163452149e-05
7 zip
Steven D'Aprano added the comment:
What are you actually reporting? What part of the documentation do you think
should be changed, why should it be changed, and what should it be changed to?
It is normal for different algorithms to perform with different speed. I'm not
sure what t
Steven D'Aprano added the comment:
> My history file is only 500 lines.
*slaps forehead*
Of course it is, I'm running a customer history hook that has a limit of 500
lines in the history file.
It looks to me that by default the history feature is set to unlimited lines,
so
Steven D'Aprano added the comment:
How very odd. I use the Python interactive interpreter extensively, and have
done so for years. My history file is only 500 lines.
Did you happen to inspect the file before deleting it to see if it contained
something odd?
What does this print fo
Steven D'Aprano added the comment:
Works correctly for me in the Python interpreter.
Please check if it works for you in the Python interpreter, if it does, then it
is a bug in Jupyter and should be reported to them, we cannot do anything to
fix it.
--
nosy: +steven.da
Steven D'Aprano added the comment:
On Fri, Aug 14, 2020 at 02:03:37PM +, Seth Woodworth wrote:
> I'm exploring what unicode code points can be used as valid starting
> characters for identifiers.
I presume you have seen the documention here:
https://docs.python
Steven D'Aprano added the comment:
> I wrap a function's logic with `gc.disable()` to prevent GC from triggering
> some race condition.
If this race condition is a bug in gc, then we should fix that.
If it is a bug in your code, surely you should fix that rather than disable
Steven D'Aprano added the comment:
Hi Seth,
Surely you aren't relying on the behaviour that names in `__all__` *aren't*
normalised but others are?
Rather than a warning, I think the right solution here is to normalise the
names in `__all__`.
--
nosy:
Steven D'Aprano added the comment:
On Tue, Aug 11, 2020 at 07:16:20AM +, Ramesh Sahoo wrote:
> for i in stack:
> print("inside if Popped =",stack.pop(stack.index(i)))
You are mutating the list while you iterate over it. This is prone to
cause trouble. Her
Steven D'Aprano added the comment:
The documentation says:
"Allowing subclassing of enums that define members would lead to a violation of
some important invariants of types and instances."
but it isn't clear what those invariants are, or why it is more of a problem
Steven D'Aprano added the comment:
Python 3.6 has reached security-fix only stage:
https://www.python.org/dev/peps/pep-0494/#schedule-last-bugfix-release
so even if this is a bug, it won't be fixed in 3.6.
I cannot reproduce this in 3.7, and Eric cannot reproduce in 3.6.9, so I&
Change by Steven D'Aprano :
--
resolution: -> not a bug
stage: -> resolved
status: open -> closed
title: Technical advise -> SPAM
___
Python tracker
<https://bugs.p
Change by Steven D'Aprano :
--
Removed message: https://bugs.python.org/msg374932
___
Python tracker
<https://bugs.python.org/issue41495>
___
___
Pytho
301 - 400 of 1443 matches
Mail list logo