Brandt Bucher added the comment:
Of course. After my PR is merged, you can make another PR that replaces the "..
TODO: BPO-39868" line with a description of how assignment expressions work.
Likely much of the language can be borrowed from the PEP.
Let me know if you need hel
Change by Brandt Bucher :
--
keywords: +patch
pull_requests: +18151
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/18793
___
Python tracker
<https://bugs.python.org/issu
Brandt Bucher added the comment:
Sorry, I hadn't seen your comment... :(
I've already finished the grammar specification bit, but not the prose
description of how assignment expressions work, etc.
How about I leave that empty in my PR and you can actually do the documentation
part
New submission from Brandt Bucher :
It looks like https://docs.python.org/3/reference/expressions.html and
https://docs.python.org/3/reference/compound_stmts.html were never updated for
named expressions.
Because this change has to be backported, it's sort of a blocker for my PEP 614
doc
Brandt Bucher added the comment:
Agreed. I'll have something up later, hopefully.
I'll add a tiny blurb to whatsnew, as well as adding the PEP to the "See also:"
note in https://docs.python.org/3.9/reference/compound_stmts.html and updating
the mini-grammar there. I don't thin
Change by Brandt Bucher :
--
pull_requests: +18086
pull_request: https://github.com/python/cpython/pull/18729
___
Python tracker
<https://bugs.python.org/issue36
Brandt Bucher added the comment:
Sounds good, I'll have these up soon.
--
___
Python tracker
<https://bugs.python.org/issue36144>
___
___
Python-bugs-list mailin
Brandt Bucher added the comment:
I think we're only seriously considering the first variant (although
implemented slightly differently, see my last two messages). And __ror__ would
probably change, returning the type of self.
What are the "problems" with it, exactl
Brandt Bucher added the comment:
Just to clarify:
If we decide to check isinstance(other, (ChainMap, dict)), '|' should probably
be used.
If we decide to check isinstance(other, Mapping), I think the copy/update
methods should be used
Brandt Bucher added the comment:
> Im not sure if the dict(other) cast is the best way to go about it. Maybe
> this would work?
Yeah, I was imagining something like that... I used the cast for brevity in my
reply but that probably wasn't helpful.
Note that for __or__, we probabl
Brandt Bucher added the comment:
...however, I could also see the (similar):
ChainMap(other, *cm.maps) # Note that `other` is the original reference
here.
Being okay as well. Maybe even better, now that I've written it out.
--
___
Python
Brandt Bucher added the comment:
I believe that:
cm | other
Should return the equivalent of:
ChainMap(cm.maps[0] | dict(other), *cm.maps[1:])
--
___
Python tracker
<https://bugs.python.org/issue36
Brandt Bucher added the comment:
> Note that in your last message, `d1 |= cm2` will fail for this reason. You
> can of course fix that with `d1 |= dict(cm2)`, although IIUC there's no
> reason one of the maps couldn't be some other [Mutable]Mapping.
Mappings and iterables
Brandt Bucher added the comment:
> I think for `|=` the only choice is for it to be essentially an alias to
> `.update()`. So that means `cm |= other` becomes `cm.maps[0].update(other)`.
Agreed.
> These semantics make `|=` behave rather differently from `|`. Is that okay?
> I
Brandt Bucher added the comment:
The plan is to follow dict’s semantics. The |= operator will basically delegate
to the first map in the chain. The | operator will create a new ChainMap where
the first map is the merged result of the old first map, and the others are the
same.
So, basically
Brandt Bucher added the comment:
Yep. I'm currently working on OrderedDict, defaultdict, and MappingProxyType.
My brother is looking to make his first contribution, so he'll be taking care
of ChainMap.
--
___
Python tracker
<ht
Change by Brandt Bucher :
--
title: Dictionary addition. (PEP 584) -> Dictionary union. (PEP 584)
___
Python tracker
<https://bugs.python.org/issue36144>
___
_
Brandt Bucher added the comment:
As a somewhat simpler example:
>>> f = {False: False}
>>> z = {0: 0}
>>> f | z
{False: 0}
>>> {**f, **z}
{False: 0}
>>> f.update(z); f
{False: 0}
Though these hairier cases aren't explicitly addressed, the c
Change by Brandt Bucher :
--
pull_requests: +18020
pull_request: https://github.com/python/cpython/pull/18659
___
Python tracker
<https://bugs.python.org/issue36
Brandt Bucher added the comment:
My current PR plans are:
- Docs. This will include the dict docs and the whatsnew 3.9. I assume we have
no plans to cover this in the tutorials, etc. Let me know if I'm missing
anything here.
- collections.defaultdict, with tests. I don't think this needs
Change by Brandt Bucher :
--
nosy: +brandtbucher
___
Python tracker
<https://bugs.python.org/issue39537>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Brandt Bucher :
--
nosy: +brandtbucher
resolution: -> duplicate
status: open -> closed
superseder: -> PEP 614: Relaxing Grammar Restrictions On Decorators
___
Python tracker
<https://bugs.python.or
Change by Brandt Bucher :
--
nosy: +brandtbucher
resolution: -> duplicate
stage: -> resolved
status: open -> closed
superseder: -> PEP 614: Relaxing Grammar Restrictions On Decorators
___
Python tracker
<https://bugs.python
Change by Brandt Bucher :
--
keywords: +patch
pull_requests: +17949
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/18570
___
Python tracker
<https://bugs.python.org/issu
New submission from Brandt Bucher :
The attached PR implements PEP 614's revised grammar for decorators, with
tests. In short:
decorator: '@' dotted_name [ '(' [arglist] ')' ] NEWLINE
becomes
decorator: '@' namedexpr_test NEWLINE
I'm marking it as DO-NOT-MERGE until the PEP is accepted
Change by Brandt Bucher :
--
nosy: +brandtbucher
___
Python tracker
<https://bugs.python.org/issue39411>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Brandt Bucher :
--
pull_requests: +17870
pull_request: https://github.com/python/cpython/pull/18496
___
Python tracker
<https://bugs.python.org/issue39
Change by Brandt Bucher :
--
pull_requests: +17641
pull_request: https://github.com/python/cpython/pull/18264
___
Python tracker
<https://bugs.python.org/issue39
Change by Brandt Bucher :
--
nosy: +brandtbucher
___
Python tracker
<https://bugs.python.org/issue39320>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Brandt Bucher :
--
pull_requests: +17623
pull_request: https://github.com/python/cpython/pull/18243
___
Python tracker
<https://bugs.python.org/issue39
Brandt Bucher added the comment:
Perhaps. I've opened a PR to update the comment with more info.
--
___
Python tracker
<https://bugs.python.org/issue39
Change by Brandt Bucher :
--
pull_requests: +17619
pull_request: https://github.com/python/cpython/pull/18240
___
Python tracker
<https://bugs.python.org/issue39
Change by Brandt Bucher :
--
resolution: -> duplicate
___
Python tracker
<https://bugs.python.org/issue39440>
___
___
Python-bugs-list mailing list
Unsubscrib
Brandt Bucher added the comment:
Prior discussion at https://bugs.python.org/issue18305. Note the final comment.
In short, this is a breaking semantic change, and the general consensus is that
using sum for sequence concatenation is an anti-pattern.
--
nosy: +brandtbucher
Change by Brandt Bucher :
--
components: +Library (Lib) -Extension Modules
nosy: +brandtbucher
resolution: -> fixed
stage: -> resolved
status: open -> closed
versions: -Python 3.5, Python 3.6, Python 3.7, Python 3.8
___
Python tracke
Brandt Bucher added the comment:
See prior discussion on this here:
https://github.com/python/cpython/pull/11787#discussion_r256442282
--
___
Python tracker
<https://bugs.python.org/issue38
Brandt Bucher added the comment:
I'm not sure what you mean when you say "modulefinder currently will detect
modules imported by a script dynamically by running the script"... modulefinder
is completely static, no?
I also think that changing sys.path like this is a bad ide
Change by Brandt Bucher :
--
nosy: +brandtbucher
___
Python tracker
<https://bugs.python.org/issue38870>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Brandt Bucher :
--
pull_requests: +16790
pull_request: https://github.com/python/cpython/pull/17298
___
Python tracker
<https://bugs.python.org/issue38
Change by Brandt Bucher :
--
pull_requests: +16769
pull_request: https://github.com/python/cpython/pull/17276
___
Python tracker
<https://bugs.python.org/issue38
Brandt Bucher added the comment:
Thanks Victor. These obviously aren’t urgent, so feel free to return to them
whenever’s convenient.
I also pinged you on #17235 (_tracemalloc) too.
--
___
Python tracker
<https://bugs.python.org/issue38
Change by Brandt Bucher :
--
pull_requests: +16753
pull_request: https://github.com/python/cpython/pull/17260
___
Python tracker
<https://bugs.python.org/issue38
Change by Brandt Bucher :
--
pull_requests: +16747
pull_request: https://github.com/python/cpython/pull/17250
___
Python tracker
<https://bugs.python.org/issue38
Change by Brandt Bucher :
--
pull_requests: +16736
pull_request: https://github.com/python/cpython/pull/17236
___
Python tracker
<https://bugs.python.org/issue38
Change by Brandt Bucher :
--
pull_requests: +16735
pull_request: https://github.com/python/cpython/pull/17235
___
Python tracker
<https://bugs.python.org/issue38
Change by Brandt Bucher :
--
pull_requests: +16719
pull_request: https://github.com/python/cpython/pull/17216
___
Python tracker
<https://bugs.python.org/issue38
Change by Brandt Bucher :
--
pull_requests: +16718
pull_request: https://github.com/python/cpython/pull/17215
___
Python tracker
<https://bugs.python.org/issue38
Change by Brandt Bucher :
--
pull_requests: +16711
pull_request: https://github.com/python/cpython/pull/17206
___
Python tracker
<https://bugs.python.org/issue38
Brandt Bucher added the comment:
Yes, there are still a few dozen modules I plan to update!
--
___
Python tracker
<https://bugs.python.org/issue38823>
___
___
Change by Brandt Bucher :
--
pull_requests: +16702
pull_request: https://github.com/python/cpython/pull/17198
___
Python tracker
<https://bugs.python.org/issue38
Change by Brandt Bucher :
--
keywords: +patch
pull_requests: +16699
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/17195
___
Python tracker
<https://bugs.python.org/issu
Change by Brandt Bucher :
--
nosy: +serhiy.storchaka
___
Python tracker
<https://bugs.python.org/issue38823>
___
___
Python-bugs-list mailing list
Unsubscribe:
Brandt Bucher added the comment:
How do others feel about the creation of a new private API? It would keep these
diffs smaller and ease refactoring... and it would probably be good to have
around anyways:
/* Like PyModule_AddObject, but steals o on success AND failure. */
int
New submission from Brandt Bucher :
Many of the C stdlib modules can benefit from improved error handling during
initialization. I've now had two PRs where the authors had reference leaks on
error conditions, but defended their decisions by pointing to examples of
similar idioms all over
Change by Brandt Bucher :
--
nosy: +brandtbucher
___
Python tracker
<https://bugs.python.org/issue11354>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Brandt Bucher :
--
nosy: +brandtbucher
___
Python tracker
<https://bugs.python.org/issue25866>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Brandt Bucher :
--
title: Speed up the creation time of constant list literals. -> Speed up the
creation time of constant list and set literals.
___
Python tracker
<https://bugs.python.org/issu
Brandt Bucher added the comment:
I have created a new patch (PR 17114) that performs this optimization directly
in the compiler, rather than the peephole optimizer. I think I like the new one
better.
--
___
Python tracker
<ht
Change by Brandt Bucher :
--
pull_requests: +16621
pull_request: https://github.com/python/cpython/pull/17114
___
Python tracker
<https://bugs.python.org/issue38
Brandt Bucher added the comment:
I'm not sure listdir and walk should be sorted, for the reasons Raymond
mentioned. And I was actually surprised to learn today that pathlib.Path.glob
doesn't use the glob module internally. Was there some reasoning behind this
decision? Separator handling
Brandt Bucher added the comment:
I went ahead and opened a PR, since it's been a month.
--
___
Python tracker
<https://bugs.python.org/issue38438>
___
___
Pytho
Change by Brandt Bucher :
--
keywords: +patch
pull_requests: +16612
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/17106
___
Python tracker
<https://bugs.python.org/issu
Brandt Bucher added the comment:
I disagree somewhat with the assessment that glob provides "thin" access to OS
services. It is composed of a few low-level utilities, but it exposes them
through what I consider to be a fairly high-level, abstract, friendly interface
that (
Change by Brandt Bucher :
--
keywords: +patch
pull_requests: +16611
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/17105
___
Python tracker
<https://bugs.python.org/issu
New submission from Brandt Bucher :
This has been discussed before, but we now have examples in the news of glob's
non-deterministic behavior causing some real headaches for hundreds of people
in the scientific community. After some cursory discussion
(https://discuss.python.org/t/a-code
Change by Brandt Bucher :
--
nosy: +brandtbucher
___
Python tracker
<https://bugs.python.org/issue15243>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Brandt Bucher :
--
nosy: +brandtbucher
___
Python tracker
<https://bugs.python.org/issue9495>
___
___
Python-bugs-list mailing list
Unsubscribe:
Brandt Bucher added the comment:
This PR was closed as invalid for the same reasons Steven mentioned above.
--
nosy: +brandtbucher
resolution: -> not a bug
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bug
Brandt Bucher added the comment:
I’ve thought about it and I’m +1 on DeprecationWarning in 3.9 and SyntaxError
in 3.10.
Removing any type of legal function call is tricky, but this is such obscure,
sneaky syntax that it’s likely an accident/bug if it does pop up (that’s how I
discovered
Change by Brandt Bucher :
--
nosy: +brandtbucher
___
Python tracker
<https://bugs.python.org/issue38580>
___
___
Python-bugs-list mailing list
Unsubscribe:
Brandt Bucher added the comment:
I've found one occurrence of this in the CPython codebase, in test_ast.py.
Basically it makes sure that the following expression parses and compiles
correctly:
f(1,2,c=3,*d,**e)
I doubt that this is to protect against regressions in this specific syntax
New submission from Brandt Bucher :
Calls of the form f(name=value, *args) are currently legal syntax. The
resulting argument binding is awkward, and almost never does what you
want/expect it to:
>>> def f(x, y, z):
... print(x, y, z)
...
>>> f(x=0, *(1, 2))
Traceback
Change by Brandt Bucher :
--
pull_requests: +16423
pull_request: https://github.com/python/cpython/pull/16878
___
Python tracker
<https://bugs.python.org/issue38
Brandt Bucher added the comment:
I'm going to go ahead and close this, since the payoff doesn't seem to be worth
the effort.
Thanks for the benchmarking and feedback!
--
resolution: -> rejected
stage: patch review -> resolved
status: open -&g
Brandt Bucher added the comment:
I went ahead and ran an instrumented build on some random production code
(mostly financial data processing), just because I was curious:
BINARY_ADD ops: 3,720,776
BINARY_ADD ops with two lists: 100,452 (2.7% of total)
BINARY_ADD with new fast path: 26,357
Brandt Bucher added the comment:
Serhiy, here are the better performance measurements:
$ ./python.exe -m pyperf timeit --duplicate=1000 -s z=0 z+0 # list-add
.
Mean +- std dev: 17.3 ns +- 0.3 ns
$ ./python.exe -m pyperf timeit --duplicate=1000 -s z=0 z+0 # master
Change by Brandt Bucher :
--
pull_requests: +16298
pull_request: https://github.com/python/cpython/pull/16705
___
Python tracker
<https://bugs.python.org/issue36
Brandt Bucher added the comment:
...and obviously the gains are more pronounced for more/longer lists.
In general I'm not married to this change, though. If the consensus is "not
worth it", I get it.
But it seems like too easy of a
Brandt Bucher added the comment:
Thanks, Pablo, for providing that. So the changes look like mostly a wash on
these benchmarks.
Serhiy:
I do not see any significant change in + operator timing on my machine (again,
just a rough test):
$ ./python.exe -m timeit -s z=0 z+0 # master
Brandt Bucher added the comment:
For backward compatibility with 2 metavars, the two-name form should still be
possible. Just pass metavar=("FOO", "FOO").
--
___
Python tracker
<https://bug
Brandt Bucher added the comment:
I’m happy to write one. This seems like a pretty straightforward fix.
--
___
Python tracker
<https://bugs.python.org/issue38
Change by Brandt Bucher :
--
type: -> enhancement
___
Python tracker
<https://bugs.python.org/issue38422>
___
___
Python-bugs-list mailing list
Unsubscrib
Change by Brandt Bucher :
--
nosy: +brandtbucher
___
Python tracker
<https://bugs.python.org/issue38438>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Brandt Bucher :
--
pull_requests: -16290
___
Python tracker
<https://bugs.python.org/issue36229>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Brandt Bucher :
--
keywords: +patch
pull_requests: +16289
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/16705
___
Python tracker
<https://bugs.python.org/issu
Change by Brandt Bucher :
--
pull_requests: +16290
pull_request: https://github.com/python/cpython/pull/16705
___
Python tracker
<https://bugs.python.org/issue36
New submission from Brandt Bucher :
The attached PR adds a fast path for BINARY_ADD instructions involving two
lists, where the left list has a refcount of exactly 1.
In this case, we instead do a PySequence_InPlaceConcat operation. This has the
affect of avoiding quadratic complexity
Change by Brandt Bucher :
--
nosy: +brandtbucher
___
Python tracker
<https://bugs.python.org/issue38109>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Brandt Bucher :
--
nosy: +brandtbucher
___
Python tracker
<https://bugs.python.org/issue38307>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Brandt Bucher :
--
nosy: +brandtbucher
___
Python tracker
<https://bugs.python.org/issue38373>
___
___
Python-bugs-list mailing list
Unsubscribe:
Brandt Bucher added the comment:
...unless you'd prefer that I add them to this PR. But I think it's a better
idea to add and review them separately.
--
___
Python tracker
<https://bugs.python.org/issue38
Change by Brandt Bucher :
--
nosy: +brandtbucher
___
Python tracker
<https://bugs.python.org/issue34938>
___
___
Python-bugs-list mailing list
Unsubscribe:
Brandt Bucher added the comment:
Yes, I was thinking about that (and BUILD_CONST_KEY_MAP as well). I'll open
another PR with those as soon as this one is in.
--
___
Python tracker
<https://bugs.python.org/issue38
Change by Brandt Bucher :
--
keywords: +patch
pull_requests: +16087
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/16498
___
Python tracker
<https://bugs.python.org/issu
Change by Brandt Bucher :
--
pull_requests: +16086
pull_request: https://github.com/python/cpython/pull/16498
___
Python tracker
<https://bugs.python.org/issue33
New submission from Brandt Bucher :
The attached PR contains a small change to the peephole optimizer that converts
sequences of:
LOAD_CONST(a), LOAD_CONST(b), ..., BUILD_LIST(n)
to
LOAD_CONST((a, b, ...)), BUILD_LIST_UNPACK(1)
The improvement quickly becomes significant for lists larger
Change by Brandt Bucher :
--
keywords: +patch
pull_requests: +16051
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/16467
___
Python tracker
<https://bugs.python.org/issu
New submission from Brandt Bucher :
This patch adds four new opcode predictions:
BUILD_MAP_UNPACK_WITH_CALL -> CALL_FUNCTION_EX:
- Emitted whenever more than one map of **kwargs is unpacked into a call.
- Pair *always* occurs together.
LOAD_BUILD_CLASS -> LOAD_CONST:
- Emitted wh
Change by Brandt Bucher :
--
pull_requests: +15380
pull_request: https://github.com/python/cpython/pull/15725
___
Python tracker
<https://bugs.python.org/issue26
Brandt Bucher added the comment:
It looks like the idiom of calling PyModule_AddObject without Py_DECREF'ing on
the error condition (or even checking for it at all) has spread quite a bit
since this first reported. I'm preparing a PR to fix the other call sites.
--
nosy
401 - 500 of 543 matches
Mail list logo