New submission from Mark Dickinson :
Use `struct.calcsize('L')` if you want the standard
sizes and formats given in the documentation. The note at the top of the struct
module documentation describes the difference.
See also #1709506.
--
nosy: +mark.dickinson
resolution
Mark Dickinson added the comment:
Some of the things that might go into a PEP, or into the PEP-creation process:
- Arguments for:
(a) a new imath module, versus
(b) new functions in math, versus
(c) a 3rd party package on PyPI.
- A handful of plausible use-cases.
- Comparisons
Mark Dickinson added the comment:
Reopening as requested.
Adding a new module to the standard library is a fairly big change. I don't
think we can do that through just this issue and PR. I think we're going to
need a PEP sooner or later. (In any case, a PEP is standard procedure for a new
Mark Dickinson added the comment:
Here's the relevant part of the dev. guide:
https://devguide.python.org/stdlibchanges/#proposal-process
The PEP would also need a core dev sponsor.
--
___
Python tracker
<https://bugs.python.org/issue40
Mark Dickinson added the comment:
As to _why_ it's a false positive: at that point in the code, assuming 30-bit
limbs and an IEEE 754 binary64 "double", we have (using Python notation for
floor division)
a_size == 1 + (a_bits - 1) // 30
and
shift_digits == (a_bits -
Mark Dickinson added the comment:
I'm fairly sure that that's a false positive for `longobject.c`. Do you know of
a non-intrusive way to silence the warning?
--
___
Python tracker
<https://bugs.python.org/issue40
Change by Mark Dickinson :
--
nosy: +mark.dickinson
___
Python tracker
<https://bugs.python.org/issue40455>
___
___
Python-bugs-list mailing list
Unsubscribe:
Mark Dickinson added the comment:
Closing this. Please open a separate issue for changing the complex repr if
that's the way that you want to go.
--
resolution: -> not a bug
stage: patch review -> resolved
status: open -> closed
_
Change by Mark Dickinson :
--
resolution: -> not a bug
status: open -> pending
___
Python tracker
<https://bugs.python.org/issue40388>
___
___
Python-bugs-
Mark Dickinson added the comment:
I suspect that the OP is doing something like `random.choice(range(10**40))`:
Python 3.8.2 (default, Feb 27 2020, 19:56:42)
[Clang 10.0.1 (clang-1001.0.46.4)] on darwin
Type "help", "copyright", "credits" or
Mark Dickinson added the comment:
[Tim]
> Mark, you don't count ;-)
Yes, I was suspecting I'd fail the "real world" test. Fair enough. :-)
--
___
Python tracker
<https://bugs.pytho
Mark Dickinson added the comment:
[Victor]
> Honestly, if you consider that BaseRandom base class is not worth it, I will
> just abandon this idea.
It's not that I think it's not worth it (I'm not currently convinced either
way). It's more that if we're going to make a change, the
Mark Dickinson added the comment:
> it may be worth looking at the recent Numpy changes
Agreed: I do like the NumPy composition model (the random state object _has_ a
bit generator, rather than _being_ an extended bit generator).
With the various competing options and the lack of agreem
Mark Dickinson added the comment:
Whoops. I thought the URL highlighter would be clever enough not to include the
period. That URL is: https://github.com/mdickinson/pcgrandom
--
___
Python tracker
<https://bugs.python.org/issue40
Mark Dickinson added the comment:
[Tim]
> Who subclasses Random in the real world? Who would want to?
Um. Me?
Or at least, I *wanted* to, when I was playing around with PCG. (See
https://github.com/mdickinson/pcgrandom.) But after running into the same
inelegancies (please note that
Change by Mark Dickinson :
--
nosy: +mark.dickinson
___
Python tracker
<https://bugs.python.org/issue39471>
___
___
Python-bugs-list mailing list
Unsubscribe:
Mark Dickinson added the comment:
However, the list comprehension pattern is not as bad as lines like this one
[#1]:
map(lambda plugin: self.start_plugin(plugin), self._plugins)
... which of course stopped working as soon as we transitioned to Python 3. :-(
[#1]
https://github.com
Mark Dickinson added the comment:
This is an antipattern I've seen on multiple occasions in real code. A common
offender is:
[worker.join() for worker in workers]
Similarly, things like:
[plugin.start() for plugin in plugins]
I do think it would be worth updating the FAQ text
Mark Dickinson added the comment:
Which part of the behaviour do you think is a bug?
In version1, you want to think of the yield expression as though it were
bracketed like this:
result = yield (a+100 if b>100 else (yield a))
With the particular values of a and b that you h
Mark Dickinson added the comment:
As you say, isn't this just a personal preference?
Is there an objective reason to prefer something that accepts ".5" and rejects
"3." over something that rejects ".5" and accepts "3."?
The exact form of numbe
Mark Dickinson added the comment:
> I tried to make repr of floats producing a string which rounds up with eval()
We've looked at this before. There just isn't any sane and easy way to do this,
except for changing the repr to be "complex(real, imag)", which is the solution
Mark Dickinson added the comment:
This was discussed previously in #37000.
I agree that `getrandbits(0)` should succeed.
--
___
Python tracker
<https://bugs.python.org/issue40
Mark Dickinson added the comment:
Another related issue is #23229, where Guido says (in msg233963):
> BTW I don't want repr() of a complex number to use the
> complex(..., ...) notation -- it's too verbose.
--
___
Python tracker
Change by Mark Dickinson :
--
keywords: +patch
pull_requests: +18849
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/19498
___
Python tracker
<https://bugs.python.org/issu
Mark Dickinson added the comment:
> The Imaginary type could help to solve other "gotchas".
Yes, it's an attractive proposition from many angles: e.g., multiplying by 1j
could do the correct quarter-turn rotation in the complex plane, keeping all
signs correct, so that multiply
Mark Dickinson added the comment:
See also #25839, #22548; there's lot of discussion of the core issue on those
tickets. As Serhiy says, the only reasonable "true" fix would be to have 1j be
a genuine imaginary literal, but that's a lot of work and potential disruption
(not ju
Mark Dickinson added the comment:
Thanks for the report! Now fixed.
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
type: enhancement -> behavior
___
Python tracker
<https://bugs.python
Change by Mark Dickinson :
--
keywords: +patch
pull_requests: +18718
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/19357
___
Python tracker
<https://bugs.python.org/issu
Mark Dickinson added the comment:
Agreed with Eric and Serhiy. This seems to be a misunderstanding about the
scope of NotImplemented.
@Hameer Abbasi: if you have an example of a problem that would be solved by
this behaviour change, and which can't be solved simply by raising TypeError
Change by Mark Dickinson :
--
nosy: +mark.dickinson
___
Python tracker
<https://bugs.python.org/issue40117>
___
___
Python-bugs-list mailing list
Unsubscribe:
Mark Dickinson added the comment:
@Mouse: replace the last block of your code with something like this:
# Start worker processes
workers = []
for m in range(nProcesses):
p = mp.Process(target=getElements, args=(q, tSleep / 1000, m))
workers.append(p
Mark Dickinson added the comment:
@Mouse: see #28965. The fix for the code you show is to join the child
processes before the main process starts exiting.
--
nosy: +mark.dickinson
___
Python tracker
<https://bugs.python.org/issue33
Change by Mark Dickinson :
--
nosy: +mark.dickinson
___
Python tracker
<https://bugs.python.org/issue40028>
___
___
Python-bugs-list mailing list
Unsubscribe:
Mark Dickinson added the comment:
Ah yes; looking at the `black` output, there's also an opportunity for an
exciting discussion about trailing commas here :-)
--
___
Python tracker
<https://bugs.python.org/issue39
Mark Dickinson added the comment:
This feels like something that's very much down to personal preference.
I also prefer the closing "]" and ")" characters on their own lines, but I'd be
happy with an argument to ast.dump giving me that option.
--
n
Mark Dickinson added the comment:
> This example can simply be dropped now.
It could be, but it would be better to replace it with a different example that
works. Any suggestions?
--
___
Python tracker
<https://bugs.python.org/issu
Change by Mark Dickinson :
--
pull_requests: +18393
pull_request: https://github.com/python/cpython/pull/19042
___
Python tracker
<https://bugs.python.org/issue38
Mark Dickinson added the comment:
Zackery: Thanks for the fix! Now merged and backported to 3.8 and 3.7.
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Mark Dickinson added the comment:
New changeset 4dcfe5f2e4bad8e03990de75d8d4ec20e8aa23b3 by Mark Dickinson in
branch '3.7':
[3.7] bpo-39871: Fix possible SystemError in atan2, copysign and remainder
(GH-18806) (GH-18990)
https://github.com/python/cpython/commit
Mark Dickinson added the comment:
New changeset e634a8ac1f8a2904a2241b83fc5e4c9f40d5c7ca by Mark Dickinson in
branch '3.8':
[3.8] bpo-39871: Fix possible SystemError in atan2, copysign and remainder
(GH-18806) (GH-18989)
https://github.com/python/cpython/commit
Change by Mark Dickinson :
--
pull_requests: +18337
pull_request: https://github.com/python/cpython/pull/18990
___
Python tracker
<https://bugs.python.org/issue39
Change by Mark Dickinson :
--
pull_requests: +18336
pull_request: https://github.com/python/cpython/pull/18989
___
Python tracker
<https://bugs.python.org/issue39
Mark Dickinson added the comment:
New changeset 5208b4b37953a406db0ed6a9db545c2948dde989 by Zackery Spytz in
branch 'master':
bpo-39871: Fix possible SystemError in atan2, copysign and remainder (GH-18806)
https://github.com/python/cpython/commit/5208b4b37953a406db0ed6a9db545c2948dde989
Mark Dickinson added the comment:
[Raymond]
> I prefer what we have now. The language is consistent [...]
Agreed. I don't see value in having two different sets of rules, one for
numeric literals and one for explicit str-to-int conversions. And if we *were*
to adopt a different
Mark Dickinson added the comment:
The lines here look odd to me:
https://github.com/python/cpython/blob/363fab83b8a0e6d924c7a7c577feec6a2812bb8c/Modules/_randommodule.c#L290-L291
args[0] = arg;
n = PyObject_Vectorcall(_randomstate_global->Long___abs__, args
Change by Mark Dickinson :
--
resolution: -> not a bug
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Mark Dickinson added the comment:
In this line:
> spec = spec_from_file_location("subsubpkg_rel",
> "/home/yon/myproj/mypkg/subpkg/subsubpkg_rel/__init__.py")
try providing the fully-qualified name, instead of just "subsubpkg_rel". That
i
Mark Dickinson added the comment:
No problem; I'll likely pick it up (if no-one else does) in the next few days.
--
assignee: -> mark.dickinson
___
Python tracker
<https://bugs.python.org/issu
Mark Dickinson added the comment:
@David: do you have any interest in creating a PR?
--
___
Python tracker
<https://bugs.python.org/issue39871>
___
___
Pytho
Mark Dickinson added the comment:
Nice find. This affects not just copysign, but all of the math module functions
that use FUNC2 under the hood. (I think that's just "remainder", "atan2" and
"copysign".)
--
Change by Mark Dickinson :
--
nosy: +mark.dickinson
___
Python tracker
<https://bugs.python.org/issue39871>
___
___
Python-bugs-list mailing list
Unsubscribe:
Mark Dickinson added the comment:
These results are hardly surprising, given the algorithms used. But why would
you consider this a problem?
If you want your randrange(n) and randrange(m) results to be independent, don't
generate them from the exact same random source, starting
Mark Dickinson added the comment:
Thank you for reviewing!
--
___
Python tracker
<https://bugs.python.org/issue39530>
___
___
Python-bugs-list mailing list
Unsub
Change by Mark Dickinson :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Mark Dickinson added the comment:
See also the discussion in #38747 (also opened by Marco), which was closed as
rejected. This issue is close to a duplicate of that one.
--
___
Python tracker
<https://bugs.python.org/issue39
Mark Dickinson added the comment:
Is this even possible in a plain text console (or plain text console + GNU
readline-equivalent)?
> Bracketed paste mode is implemented in many text editors, as vi.
Sure, but the REPL is not a text editor, and knows very little about the
context it's be
Mark Dickinson added the comment:
There's a PR on GitHub. (GH-18615)
Terry: I think you've looked at similar sorts of documentation clarifications
in the past. Would you have any interest in reviewing this one?
--
nosy: +terry.reedy
___
Python
Change by Mark Dickinson :
--
resolution: -> third party
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Mark Dickinson added the comment:
Hmm. I don't see anything here that would indicate that this is a core Python
problem. This looks like something you'd need to take up with the tensorflow
folks. (Investigations could conceivably turn up a CPython bug as the
underlying cause, in which case
Change by Mark Dickinson :
--
keywords: +patch
pull_requests: +17980
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/18615
___
Python tracker
<https://bugs.python.org/issu
Mark Dickinson added the comment:
It looks as though this has been addressed, and can be closed.
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Change by Mark Dickinson :
--
nosy: -mark.dickinson
___
Python tracker
<https://bugs.python.org/issue5996>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Mark Dickinson :
--
nosy: -mark.dickinson
___
Python tracker
<https://bugs.python.org/issue39599>
___
___
Python-bugs-list mailing list
Unsubscribe:
Mark Dickinson added the comment:
I'm inclined to close this. Raymond, Tim: thoughts?
--
assignee: -> mark.dickinson
nosy: +rhettinger, tim.peters
___
Python tracker
<https://bugs.python.org/issu
Mark Dickinson added the comment:
For tracker historians: see also #457066
--
___
Python tracker
<https://bugs.python.org/issue36027>
___
___
Python-bugs-list m
Mark Dickinson added the comment:
Merged; thank you to all involved.
--
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.org/i
Mark Dickinson added the comment:
New changeset 559e7f165ad03731e6bc2211c0e6d8d9c02fb549 by Serhiy Storchaka in
branch 'master':
bpo-39648: Expand math.gcd() and math.lcm() to handle multiple arguments.
(GH-18604)
https://github.com/python/cpython/commit
Mark Dickinson added the comment:
@Ananthakrishnan: Do you know how arrays and pointers work in C?
--
___
Python tracker
<https://bugs.python.org/issue39
Mark Dickinson added the comment:
@Ananthakrishnan: Sure, go ahead.
Let's make the process a bit more streamlined than last time around: see if you
can put together a PR that passes all the CI checks before asking for review.
If you get stuck, make a work-in-progress PR and ask for help
Mark Dickinson added the comment:
> Thanks and apologies for missing the duplicate.
Not a problem: much better to have a potential bug reported twice than not at
all.
--
___
Python tracker
<https://bugs.python.org/issu
Mark Dickinson added the comment:
Ah, found the duplicate (or at least one of them):
https://bugs.python.org/issue27463
--
components: +Interpreter Core -macOS
resolution: -> duplicate
stage: -> resolved
status: open -> closed
superseder: -> Floor division is
Mark Dickinson added the comment:
> Shouldn't the two approaches provide the same answer?
In a word, no. :-)
math.floor(1/0.01) involves *two* operations, and there's an intermediate
rounding step which happens to round the true mathematical result of 1/0.01 up
to 100.0. Taking the fl
Change by Mark Dickinson :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Mark Dickinson added the comment:
New changeset f2ee21d858bc03dd801b97afe60ee2ea289e2fe9 by ananthan-123 in
branch 'master':
bpo-39479:Add math.lcm() function: Least Common Multiple (#18547)
https://github.com/python/cpython/commit/f2ee21d858bc03dd801b97afe60ee2ea289e2fe9
Change by Mark Dickinson :
--
nosy: +mark.dickinson
___
Python tracker
<https://bugs.python.org/issue35081>
___
___
Python-bugs-list mailing list
Unsubscribe:
Mark Dickinson added the comment:
> Should something like the following go in the standard library, most likely
> in the math module?
I'm not keen. Granted that the math module has exceeded its original remit of
"wrappers for libm", but even so, I'd prefer to try to limit i
Mark Dickinson added the comment:
What's slightly more interesting is the return value for a single argument
`a`, where we should be careful to return `abs(a)` rather than simply `a`.
--
___
Python tracker
<https://bugs.python.org/issue39
Mark Dickinson added the comment:
> Should it take variable number of positional arguments or a single iterable
> argument as max() and min()?
Good question: the obvious extension to the current function would be to allow
it to take multiple scalar arguments. But I don't muc
Change by Mark Dickinson :
--
resolution: -> rejected
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.org/issue39644>
___
___
Mark Dickinson added the comment:
I'm going to close this, for two reasons:
- It's not well-formed enough for a b.p.o. issue: there are too many details to
be worked out and questions to be answered. As it stands, there's nothing
actionable here.
- Adding a new module to the Python std
Change by Mark Dickinson :
--
nosy: +mark.dickinson
___
Python tracker
<https://bugs.python.org/issue39629>
___
___
Python-bugs-list mailing list
Unsubscribe:
Mark Dickinson added the comment:
> _Py_AS_GC and all APIs to get PyGC_Head from PyObject* are not only unstable,
> but also private.
Understood; thanks. I agree that there shouldn't be a guarantee for private
undocumented calls.
--
___
Mark Dickinson added the comment:
[Julien Danjou]
> As you said, if it's not part of the stable ABI it makes sense.
I think this is a misunderstanding of what the stable ABI is for. I'm not sure
whether this is spelled out explicitly anywhere, but my understanding was that
ABI break
Mark Dickinson added the comment:
Hi Katherine,
My report was really just about the last sentence, but I agree that the
"narrower" language is confusing here. If someone says that a type "A" is
narrower than type "B", that suggests to my ears that "A&
Mark Dickinson added the comment:
Here's another way to see it. Let's get the Unix timestamp for right now:
>>> from datetime import datetime
>>> epoch = datetime(1970, 1, 1)
>>> now = (datetime.now() - epoch).total_seconds()
>>> now
1581261916.910558
Mark Dickinson added the comment:
> Yes, but you get the first 1 bit for free.
Not really. :-) That's a detail of how floating-point numbers happen to be
stored; it's not really relevant here. It doesn't affect the fact that IEEE 754
binary64 floats have 53 bits of *precision*, so using
Mark Dickinson added the comment:
[Larry]
> It takes *30* bits to store the non-fractional seconds part of the current
> time in a double
I make it 31. :-)
>>> from datetime import datetime
>>> time_since_epoch = datetime.now() - datetime(1970, 1, 1)
>>> i
Mark Dickinson added the comment:
There's no other reasonable way for Python to work here. It *is* an error to
pass something that's not a callable as a thread "target", but it's a coding
error that can only be detected at runtime, not a syntax error that can be
detected statica
Mark Dickinson added the comment:
Agreed that this seems surprising.
@Vedran: Trailing zeros in a Decimal object are significant, so
`Decimal("2.0")` and `Decimal("2.00")` are different (equal, but different).
The rules about the "ideal exponent" of the res
Change by Mark Dickinson :
--
superseder: -> Add __len__ to map, everything in itertools
___
Python tracker
<https://bugs.python.org/issue39558>
___
___
Py
Mark Dickinson added the comment:
This is essentially a duplicate of #27678 and #24849 (and there may be others).
Note that the math module now has `prod`, `comb` and `perm`, which match the
lengths of the full `product`, `combinations` and `permutations` itertools
functions
Mark Dickinson added the comment:
It would also be helpful to know which platform you're observing the 100% CPU
usage on, so that we can try to reproduce.
--
___
Python tracker
<https://bugs.python.org/issue39
Mark Dickinson added the comment:
On the HEAD of the current 3.7 branch, the file you refer to has the following
code starting at line 37:
while True:
work_item = work_queue.get(block=True)
if work_item is not None:
work_item.run
Change by Mark Dickinson :
--
nosy: +mark.dickinson
___
Python tracker
<https://bugs.python.org/issue39280>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Mark Dickinson :
--
nosy: -mark.dickinson
___
Python tracker
<https://bugs.python.org/issue8912>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Mark Dickinson :
--
nosy: -mark.dickinson
___
Python tracker
<https://bugs.python.org/issue19683>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Mark Dickinson :
--
nosy: -mark.dickinson
___
Python tracker
<https://bugs.python.org/issue39108>
___
___
Python-bugs-list mailing list
Unsubscribe:
Mark Dickinson added the comment:
Let's close. This was only ever an issue in Python 2.
--
resolution: -> out of date
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.o
Mark Dickinson added the comment:
Speaking as a British, UK-based Python contributor who's unhappy with recent
political developments in the UK, I say let's close this.
--
nosy: +mark.dickinson
___
Python tracker
<https://bugs.python.
Mark Dickinson added the comment:
To be clear: the following is flawed as an accuracy test, because the
*multiplication* by 1e9 introduces additional error.
# int/int: int.__truediv__(int)
>>> abs(t - int(t/10**9 * 1e9))
172
Try this instead, which uses the Fractions module to get
701 - 800 of 6360 matches
Mail list logo