Steven D'Aprano added the comment:
What is wrong with addressing the reader as "you"?
Avoiding an affirmative tone goes directly against the style-guide you linked
to, which recommends an affirmative (positive) tone:
"The documentation focuses on affirmatively stating what th
Steven D'Aprano added the comment:
See issue #45641
--
nosy: +steven.daprano
___
Python tracker
<https://bugs.python.org/issue45642>
___
___
Python-bugs-list m
Steven D'Aprano added the comment:
See issue #45642
--
___
Python tracker
<https://bugs.python.org/issue45641>
___
___
Python-bugs-list mailing list
Unsub
Steven D'Aprano added the comment:
Please read:
https://stackoverflow.com/help/minimal-reproducible-example
http://www.sscce.org/
--
___
Python tracker
<https://bugs.python.org/issue45
Steven D'Aprano added the comment:
You need to give us some steps to reproduce this error, or we cannot even begin
to try to fix it.
What are the minimum steps needed to reproduce the error?
--
nosy: +steven.daprano
___
Python tracker
<ht
Steven D'Aprano added the comment:
This may be an example of the problem:
https://discuss.python.org/t/why-does-venv-not-work-on-my-windows-system/11167
The poster there hasn't responded yet, so it isn't clear what is the actual
issue is. But it looks suspiciously like a failure to realise
Steven D'Aprano added the comment:
Now that we're in 3.11, people are starting to notice that stringy annotations
are not the default (see #45499 for example).
What can we do to get PEP 649 moving forward?
--
nosy: +steven.daprano
___
Python
Change by Steven D'Aprano :
--
resolution: -> duplicate
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Steven D'Aprano added the comment:
Duplicate: #38605
--
___
Python tracker
<https://bugs.python.org/issue45499>
___
___
Python-bugs-list mailing list
Unsub
Steven D'Aprano added the comment:
> Why is it still not automatically inside python 3.11.0a1?
Probably because this is the .0a1 version, and making it mandatory just hasn't
been done yet. The developers are only human and can't do everything instantly.
--
nosy: +steven.dapr
Steven D'Aprano added the comment:
See also the FAQs:
https://docs.python.org/3/faq/programming.html#why-do-lambdas-defined-in-a-loop-with-different-values-all-return-the-same-result
--
nosy: +steven.daprano
___
Python tracker
<ht
Steven D'Aprano added the comment:
If you want pass to become an expression, what should these do?
x = pass
print(pass)
mydict[pass] = 1
type(pass)
There is nothing special about the ternary if operator. It is just an
operator like plus, minus and more. The only
Steven D'Aprano added the comment:
This is not a bug, "pass" is not an operator, it is not an expression, it is a
statement and is only allowed in places where statements are allowed.
The if expression requires all three operands to be expressions.
Even if "pass" was p
Steven D'Aprano added the comment:
Jeff makes an excellent point about the docs failing to distinguish
between language guarantees, implementation guarantees, and things which
are merely true sometimes.
On the other hand, we only need document what is true *now*, not what
may be true
New submission from Steven D'Aprano :
Why do you say that the FAQ is misleading?
If it is misleading, it should be replaced with a more correct answer, not just
deleted.
--
nosy: +steven.daprano
___
Python tracker
<https://bugs.python.
Steven D'Aprano added the comment:
Serhiy is correct. Please see the documentation.
https://docs.python.org/3/library/stdtypes.html#str.strip
If you are using version 3.9 or better, you can use removeprefix instead:
https://docs.python.org/3/library/stdtypes.html#str.removeprefix
Steven D'Aprano added the comment:
It is a bit tricky to find the documentation for the magic single underscore,
but it is here:
https://docs.python.org/3/reference/lexical_analysis.html#reserved-classes-of-identifiers
--
___
Python tracker
Steven D'Aprano added the comment:
If you are working in the interactive interpreter, you may be running into a
conflict with the "magic" variable `_` which the interactive interpreter
creates to hold the result of the last evaluated statement.
So when you evaluate `x`, and th
Steven D'Aprano added the comment:
I'm glad that you fixed the bug in your code, but this is not a bug in
Python. It isn't "a parsing issue", the code is parsed fine. What you
did was no different from:
def func():
print(x)
x = 1
except that the binding
New submission from Steven D'Aprano :
See this question on Discuss:
https://discuss.python.org/t/what-is-this-syntax-i-dont-know-how-to-fix-it/10844
It seems that IDLE allows you to save the shell output, complete with welcome
message and prompts, as a .py file, and then reopen
Steven D'Aprano added the comment:
> That is true, but there are a couple setups where that doesn't work
> (those keypresses are consumed by something else). I may not be a good
> data point though.
Can you give an example of a setup where Ctrl-D is consumed but "import
sys
Steven D'Aprano added the comment:
In the future, please remember that this is not a help desk for getting help
with your code, it is for reporting bugs. There are many forums that are happy
to help you understand why your code is not working as you expect (if you are a
beginner to Python
Steven D'Aprano added the comment:
This is not a bug, you are trying to print the value of the local variable
DiaObjectFactoryHelper before you have defined the variable.
UnboundLocalError is a subclass of NameError that is used when the undefined
name is a local variable instead
Steven D'Aprano added the comment:
> Typing `import sys; sys.exit()` every time I want to test something
> quick on the REPL is awful UX.
It truly is awful. So why do you do it that way?
There are at least four other ways to cleanly exit the REPL.
1. raise SystemExit
2. exit()
3
Steven D'Aprano added the comment:
Thank you Victor, I don't know whether I can convince you or you will
convince me, but this is very interesting one way or the other. And I
hope that Tim Holy is interested too :-)
On Wed, Sep 22, 2021 at 01:51:35PM +, STINNER Victor wrote
Steven D'Aprano added the comment:
Thanks Victor for the explanation about pyperf's addition features. They
do sound very useful. Perhaps we should consider adding some of them to
timeit?
However, in my opinion using the average is statistically wrong. Using
the mean is good when errors
Steven D'Aprano added the comment:
Oh, I forgot:
Python mailing lists and IRC:
https://www.python.org/community/lists/
https://www.python.org/community/irc/
--
___
Python tracker
<https://bugs.python.org/issue45
Steven D'Aprano added the comment:
"the expected behaviour is to return a digit with 3 decimal points"
I presume you mean a float with 3 digits after the decimal point. Three decimal
points would be a bug :-)
I am afraid that you are misinterpreting what you are seeing. Roundin
Steven D'Aprano added the comment:
Running timeit with number=1 for fast running processes is not likely to be
reliable. The problem is that modern computers are *incredibly noisy*, there
are typically hundreds of processes running on them at any one time.
Trying to get deterministic times
Steven D'Aprano added the comment:
Wait, are you talking about the list appearing to be empty during the sort?
That's expected behaviour and not a bug:
https://docs.python.org/3/library/stdtypes.html#list.sort
I'm going to close this issue as Not A Bug. If the problem is something else
Steven D'Aprano added the comment:
Sorry, it is not clear what you think is the bug. What output do you expect?
When I run the code, F and G are correctly sorted.
--
nosy: +steven.daprano
___
Python tracker
<https://bugs.python.org/issue45
Steven D'Aprano added the comment:
Oh, I forgot: this exact issue is also in the FAQs.
https://docs.python.org/3/faq/programming.html#id46
--
___
Python tracker
<https://bugs.python.org/issue45
Steven D'Aprano added the comment:
This is not a bug. No copy is made at all, neither shallow nor deep.
This is described in the documentation for built-in types:
https://docs.python.org/3/library/stdtypes.html#common-sequence-operations
and is similar to the issue in the FAQs:
https
Steven D'Aprano added the comment:
Thank you Raymond for the explanation. I didn't realise that there was a
technical reason why built-in generators had to be implemented as classes in
CPython.
Sanmitha's question was already discussed answered here:
https://discuss.python.org/t/enumerate
Steven D'Aprano added the comment:
Regarding the call to sorted that you removed.
I just realised that this was buggy! In my testing, I found that there was a
consistent speed-up by summing fractions in order of increasing denominators
(small denominators first):
>>> from fractio
Steven D'Aprano added the comment:
> rhettinger requested a review from stevendaprano yesterday
This is not a complaint Raymond, but you're too quick for me!
Your changes look good to me, thank you.
--
___
Python tracker
<https://bugs.pyth
Steven D'Aprano added the comment:
Hmmm, digging deeper, I saved the page source code and opened it with
hexdump. The relevant lines are:
7780 60 60 0d 0a 26 67 74 3b 26 67 74 3b 26 67 74 3b |``..|
7790 20 73 20 3d 20 27 30 f0 90 a4 80 30 30 27 0d 0a | s = '000'..|
which
Steven D'Aprano added the comment:
> what's really there when I copy it from Firefox is '0\U000109',
> which matches the result Max gets for individual index operations such as
> s[1].
But *not* the result that Max got from calling list().
Can you reproduce that differenc
Steven D'Aprano added the comment:
Eryk Sun said:
> The original string has the Phoenician right-to-left character at index 1,
> not at index 3.
I think you may be mistaken. In Max's original post, he has
s = '000X'
where the X is actually the Phoenician ALF character. At
Steven D'Aprano added the comment:
I'm afraid I cannot reproduce the problem.
>>> s = '000ऀ' # \U00010900
>>> s
'000ऀ'
>>> s[0]
'0'
>>> s[1]
'0'
>>> s[2]
'0'
>>> s[3]
'ऀ'
>>> list(s)
['0', '0', '0', 'ऀ']
That is using Python 3
Steven D'Aprano added the comment:
> Another case is in round trip processing of JSON or YML.
Sorry for my ignorance, but I don't see how or why an unordered
comparison would help you with round-tripping JSON or YAML.
The order of key:value pairs in JSON is not guaranteed to be preser
Steven D'Aprano added the comment:
What is your use-case for having dicts that differ only in order compare
unequal?
I can't think of any reason why I would want such a comparison, but if I did,
it's a trivial one-liner:
d1 == d2 and all(k1 == k2 for k1, k2 in zip(d1, d2
Steven D'Aprano added the comment:
See #42368
Also this thread:
https://mail.python.org/pipermail/python-dev/2019-February/156466.html
--
nosy: +steven.daprano
type: behavior -> enhancement
___
Python tracker
<https://bugs.python.org/issu
Steven D'Aprano added the comment:
See thread on Python-Ideas.
https://mail.python.org/archives/list/python-id...@python.org/thread/EDRF2NR4UOYMSKE64KDI2SWUMKPAJ3YM/
--
___
Python tracker
<https://bugs.python.org/issue33
New submission from Steven D'Aprano :
Packing errors using struct in 3.9 seem to be unnecessarily obfuscated to me.
>>> import struct
>>> struct.pack('H', 7)
Traceback (most recent call last):
File "", line 1, in
struct.error: ushort
Steven D'Aprano added the comment:
This is not a bug, and I'm unconvinced that it needs a documentation change. If
you are using struct to assemble values, you need to know the meaning of the
struct format.
It returns a float NAN because you give it the bit pattern of a NAN.
For C singles
New submission from Steven D'Aprano :
Truth testing states that "Any object can be tested for truth value" but from
3.9 onwards, doing so with NotImplemented is deprecated and will be made a
TypeError.
https://docs.python.org/3/library/stdtypes.html#truth-value-testing
It is als
Steven D'Aprano added the comment:
On Mon, Aug 23, 2021 at 05:42:59PM +, Serhiy Storchaka wrote:
>
> Serhiy Storchaka added the comment:
>
> Should getattr() normalize attribute name? If no, it will produce
> surprises further along the way. If yes, it will add signific
New submission from Steven D'Aprano :
I think there is an opportunity to speed up some unicode normalisations
significantly.
In 3.9 at least, the normalisation appears to be dependent on the length of the
string:
>>> setup="from unicodedata import normalize; s = 'revers
Steven D'Aprano added the comment:
Okay, reopening the ticket with a new description.
`from module import *` should use the same NFKC normalisation on the names in
`__all__`.
To be clear, I don't propose that `__all__` should be modified.
--
resolution: not a bug ->
st
Steven D'Aprano added the comment:
Eric, I think you may have been too hasty to close this as "not a bug".
It has tripped people up before. See #41542 which has also been closed (I also
think prematurely).
We normalise variable names with NFKC, so we should normalise the values i
Steven D'Aprano added the comment:
I'm sorry if you don't like the design of the pack() method, but all the
examples in the documentation show how it behaves. It is behaving as documented
and designed.
https://docs.python.org/3/library/tkinter.html
The bug here is in your own code. You
New submission from Steven D'Aprano :
Hi Irit, thanks for looking at #28327.
Sorry to be That Guy who can't do it himself, but I'm still stuck with old tech
and ignorance about the git way of doing things, which limits my ability to do
PRs :-(
Would you be willing to add a regression test
Steven D'Aprano added the comment:
To understand why your code doesn't work, run this:
items = ['a', '', 'b', '', 'c', '', 'd', '', 'e', '']
print(len(items))
for index, item in enumerate(items):
print(index, repr(item), items)
if item == '':
items.remove('')
When you
Steven D'Aprano added the comment:
Not a bug. Use this instead:
def rv(items):
for item in items[:]: # iterate over a copy
if not (item.isspace() or item == ''):
items.remove(item)
return items
Or the same as above, as a list comprehension, no need to make
Steven D'Aprano added the comment:
As a new feature, the absolute earliest we could add this would be Python 3.11.
As new syntax, it would need a PEP.
https://www.python.org/dev/peps/
--
versions: +Python 3.11
___
Python tracker
<ht
Steven D'Aprano added the comment:
> Python 3 has removed the capability to create a list from a range.
That's incorrect. You can do `list(range(1,100,2))`. But generally, why create
a list? range objects support many of the list APIs:
- iteration
- fast containment tests `x in range(1,
Steven D'Aprano added the comment:
The importing from multiple threads is possibly also non-deterministic, but I'm
not an expert on the importlib module.
It looks to me like a another plausible source of random/arbitrary behaviour
could be:
1. Within a single process, you have two threads
Steven D'Aprano added the comment:
"Undefined behaviour" has a particular meaning to C programmers, which is
relevant to Python because the interpreter is written in C. It's probably best
not to use that term here.
Let me see if I understand your issue.
* You have two separ
Steven D'Aprano added the comment:
You're still not giving a reproducible example. The PyPy people will be
unable to resolve this unless you give them a reproducable example.
'D:/somepath contains chinese character' is not a path with Chinese
characters in it. If you refuse to give enough
Steven D'Aprano added the comment:
Also, we need to know the version of Python and your OS.
--
___
Python tracker
<https://bugs.python.org/issue44898>
___
___
Steven D'Aprano added the comment:
How did you enter the Chinese characters?
It works for me:
>>> filename = 'Beijing 北京市'
>>> with open(filename, 'w') as f:
... f.write('data')
...
4
>>> from pathlib import Path
>>> p = Path(filename)
>>
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:
John, there's no need to establish every feature in Python that you are **not**
questioning. Please focus on the behaviour that you think is a bug. Pretty much
nothing in your example before the line "So everything here is working as
expected" is
Steven D'Aprano added the comment:
I've replicated this under Linux as well.
def test():
start = time.time()
end = datetime.datetime.now()
start = datetime.datetime.fromtimestamp(start, None)
assert end >= start
Then run it in a loop:
>>> for i in ra
Steven D'Aprano added the comment:
Confirmed on Windows with Python 3.9.6.
--
nosy: +steven.daprano
type: -> behavior
versions: +Python 3.9
___
Python tracker
<https://bugs.python.org/issu
Steven D'Aprano added the comment:
On Thu, Aug 05, 2021 at 12:00:31PM +, krey wrote:
> @steven.daprano My suggestion was changing the names of the args, not the
> order
>
> Current
> def os.symlink(src, dst):
> ln -s src dst
So far so good.
> Changing the n
Steven D'Aprano added the comment:
There is no one single set of names used by `ln` that we could have
chosen. Any choice we made would have annoyed some people.
I strongly argue that, of all the various naming conventions in common
usage (see below), Python's choice of src, dest (source
Steven D'Aprano added the comment:
Yes, we have a process:
- At least one full release with a pending deprecation warning (silent
by default); 3.11 is the earliest that could take place.
- At least one full release with an active deprecation warning; 3.12
would be the earliest
Steven D'Aprano added the comment:
Order of arguments for ln:
ln -s SOURCE DESTINATION
Order of arguments for os.symlink:
os.symlink(SOURCE, DESTINATION)
They are exactly the same order.
> Everywhere else I've seen, arrows (or directed edges in a graph) point as
> SOURCE -&g
Steven D'Aprano added the comment:
There is nothing wrong with saying
Create a symbolic link pointing to `src` named `dst`.
That is grammatically correct English.
We could say "create a sym link called dst pointing to src" but they mean
exactly the same thing. And given that
Steven D'Aprano added the comment:
On Wed, Aug 04, 2021 at 03:25:06PM +, Pooia wrote:
> unexcpeted indent
What about an unexpected indent?
Please explain what you think the bug is in full sentences, showing some
example code we can
Steven D'Aprano added the comment:
I don't understand what you mean by "Python can't use '\t' character." Can you
demonstrate an example? It works for me.
--
nosy: +steven.daprano
___
Python tracker
<https://bugs.python.o
Steven D'Aprano added the comment:
> I expect sys.stdout to have utf-8 encoding inside the redirect because
> the buffer accepts unicode code points (not bytes)
And the buffer stores unicode code points, not bytes, so why would there
be an encoding?
Just to get this out of the way, i
Steven D'Aprano added the comment:
Why do you expect UTF-8 inside the redirect_stdout block?
io.StringIO doesn't have an encoding - it stores strings, not bytes.
If z3-solver cannot deal with StringIO, then surely that's a bug in z3-solver?
--
nosy: +steven.daprano
Steven D'Aprano added the comment:
Hi Pavel.
Thank you for your submission, but your request is based on a serious
misunderstanding of the koan from PEP 20.
You might consider that Python has, for example, both for loops and while
loops; it has lists and tuples; it has ints and floats
Steven D'Aprano added the comment:
BTW, chained comparisons are usually written like this:
0 <= x <= 100
a == b == c
spam is eggs is None
or similar. They do look weird and confusing when they include the `in`
operator. Best not to write chained comparisons inv
Steven D'Aprano added the comment:
Hi Antel, thank you for your submission but this is not a bug. This is a bug
tracker for reporting bugs, not a help desk to ask for help understanding code.
There are many forums where you can ask for help, I suggest that you could try
places like
Steven D'Aprano added the comment:
This is a bug tracker, not a community help desk or forum to discuss code you
would like to write but don't know how.
I suggest you subscribe to the Python-List mailing list, or go to Reddit's
r/learnpython, as post there to discuss this. But you might
Steven D'Aprano added the comment:
Hi Joker.
Please don't post screenshots and images of code. It is difficult or impossible
for the visually impaired and blind to view with a screen reader, and as we
don't use Photoshop to edit code, it makes it hard to copy and run the code.
Your code
Steven D'Aprano added the comment:
Confirmed that it is working in Linux. I assume Paul has tested it under
Windows, and it sounds like Ronald has tested it in VS Code as well.
I'm closing this as Not A Bug.
Priyanshu, if you disagree and can replicate the error, this time checking
Change by Steven D'Aprano :
--
nosy: +steven.daprano
___
Python tracker
<https://bugs.python.org/issue44746>
___
___
Python-bugs-list mailing list
Unsubscribe:
Steven D'Aprano added the comment:
Ah, I missed that and totally misinterrpreted other comments.
Confirmation bias at work: I saw the code I expected to see, not the
code that was actually there :-(
All good, I agree that it is a bug in the class, not in the language.
Sorry for the noise
Steven D'Aprano added the comment:
This feature (or one very like it) has been requested again, this time with an
"i" prefix:
https://discuss.python.org/t/indented-multi-line-string-literals/9846/1
--
___
Python tracker
<https://bu
Steven D'Aprano added the comment:
How is this not a regression? And a very serious one by the sound of it. All
the examples that are said to go into an infinite loop work fine in 3.9.
(Obviously I can't check the match statement example in 3.9.)
If the Sequence Protocol really has been
Steven D'Aprano added the comment:
That's not a Python issue, that's a feature of your terminal. That's how tabs
are supposed to work.
By default, most terminals set tab stops every 8 columns. Printing a tab
character jumps to the next tab stop.
If you are using Linux or Mac, you can use
Steven D'Aprano added the comment:
I'm sorry, I don't understand what "different results for different values" you
are talking about.
Can you please copy and paste (not a screen shot) code demonstrating:
- what code you ran
- what result you expected
- why you expected it
- and w
Steven D'Aprano added the comment:
What exactly is a "pseudo-module"? I can only imagine it is something
like sys, which exists internally in the interpreter but doesn't have an
independent existence as a .py .dll or .so file.
That's not the case with `__future__`, which is
Steven D'Aprano added the comment:
I might be missing something here, but if you send arbitrary binary data to
stdout, where it gets written to the terminal, strange things are likely to
happen. The terminal interprets the shell characters before Python gets to see
them.
I think
Steven D'Aprano added the comment:
If you really need to get Python 2.0.1 working on Windows 3.1 for some reason,
you might find somebody interested in the problem on one of the various Python
forums.
You could try the Python-Dev mailing list, or Python-List mailing list, or
Reddit's r
Steven D'Aprano added the comment:
Python 2.0.1 is 20 years old and not supported.
I don't think that installing Python on Windows 3.1 has ever been supported.
But even if it was, we're certainly not supporting it now.
--
nosy: +steven.daprano
resolution: -> wont fix
st
Steven D'Aprano added the comment:
I agree that the contradiction should be resolved.
There is an actual `__future__.py` module, which on my system it is at
/usr/local/lib/python3.9/__future__.py
But when we use the special syntax:
from __future__ import
it doesn't do a normal import
Steven D'Aprano added the comment:
Not a bug, this is due to operator precedence.
It is documented under the power operator:
https://docs.python.org/3/reference/expressions.html#the-power-operator
and in the operator precedence table:
https://docs.python.org/3/reference/expressions.html
Steven D'Aprano added the comment:
args.seed if args.seed else SEED is not doing what you think it is doing.
SEED is an *int* but args.seed is a *str*:
>>> random.seed(6385845682483836956)
>>> random.randint(10, 500)
92
>>> random.seed('6385845682483836956')
>
Steven D'Aprano added the comment:
Jack, Thereisfood is using Windows, which I understand has a clock with
millisecond accuracy. So a sleep of a millisecond should, I think, work on
Windows even if it doesn't work on Linux.
Could a Windows expert clarify please?
--
nosy
Steven D'Aprano added the comment:
On Thu, Jul 15, 2021 at 10:24:34AM +, Patrick Reader wrote:
> It may be, but in that case, why do LOAD_BUILD_CLASS and things still use it?
They're allowed to use CPython implementation details because they are
part of the CPython implementat
Steven D'Aprano added the comment:
Isn't `__builtins__` a private CPython feature? Other implementations may not
have it or use it, and it is my understanding that we should not touch it.
--
nosy: +steven.daprano
___
Python tracker
<ht
Steven D'Aprano added the comment:
On Wed, Jul 14, 2021 at 08:10:51PM +, Aaron Meurer wrote:
> There are already pseudo-keywords in the language, in particular,
> super()
super is not a pseudo-keyword. It's a regular builtin object that
interacts with some (quite clever) compiler
Steven D'Aprano added the comment:
On Tue, Jul 13, 2021 at 01:58:30AM +, Taylor Alexander wrote:
> I would push back against the idea that this is about laziness. It
> sounds like this is about reducing user confusion.
Users aren't *confused* by the instructions, which are
Steven D'Aprano added the comment:
numpy is a third-party library, you will have to report it to them, we can't do
anything about it.
--
nosy: +steven.daprano
resolution: -> third party
stage: -> resolved
status: open -> closed
_
101 - 200 of 1436 matches
Mail list logo