[issue35224] PEP 572: Assignment Expressions

2019-09-11 Thread Guido van Rossum


Guido van Rossum  added the comment:

Congrats! Let's party.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-09-11 Thread Emily Morehouse


Emily Morehouse  added the comment:

All areas that were identified for additional work have been addressed.

If there is anything else that needs to be improved or updated, please create a 
new issue.

Thanks!

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-09-11 Thread Stéphane Wirtel

Stéphane Wirtel  added the comment:


New changeset be2aa58fdc29cf13aabff6d6712e7853e94e88f8 by Stéphane Wirtel (Miss 
Islington (bot)) in branch '3.8':
bpo-35224: Additional documentation for Assignment Expressions (GH-15935) 
(GH-15967)
https://github.com/python/cpython/commit/be2aa58fdc29cf13aabff6d6712e7853e94e88f8


--
nosy: +matrixise

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-09-11 Thread miss-islington


miss-islington  added the comment:


New changeset 6357c95716d89ac1f80587fbc4133df8d2e8396c by Miss Islington (bot) 
(Emily Morehouse) in branch 'master':
bpo-35224: Additional documentation for Assignment Expressions (GH-15935)
https://github.com/python/cpython/commit/6357c95716d89ac1f80587fbc4133df8d2e8396c


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-09-11 Thread miss-islington


Change by miss-islington :


--
pull_requests: +15600
pull_request: https://github.com/python/cpython/pull/15967

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-09-11 Thread Emily Morehouse


Change by Emily Morehouse :


--
pull_requests: +15572
pull_request: https://github.com/python/cpython/pull/15935

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-08-05 Thread Nick Coghlan


Nick Coghlan  added the comment:

Proposed PEP update is here: https://github.com/python/peps/pull/1140

The update also aims to clarify *why* we're doing the extra work in CPython's 
compiler to make these cases fail (i.e. we don't want to implicitly impose the 
current CPython runtime behaviour on other implementations)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-08-04 Thread Guido van Rossum


Guido van Rossum  added the comment:

Can you suggest a PEP update too, for the case that goes beyond the PEP?
And please provide examples (not everybody knows immediately what
"outermost iterable expression" refers to. :-)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-08-04 Thread Nick Coghlan


Nick Coghlan  added the comment:

Thanks Guido. The former test cases that the new PR removes are the following:

res = [i := i for i in range(5)]
res = [i := 0 for i, j in [(1, 2), (3, 4)]]
res = [(i := 0, j := 1) for i, j in [(1, 2), (3, 4)]]
res = [(i := i, j := j) for i, j in [(1, 2), (3, 4)]]
res = [(i := j, j := i) for i, j in [(1, 2), (3, 4)]]

These all raise TargetScopeError with the PR applied:

>>> res = [i := i for i in range(5)]
  File "", line 1
TargetScopeError: named expression cannot rebind comprehension iteration 
variable
>>> res = [i := 0 for i, j in [(1, 2), (3, 4)]]
  File "", line 1
TargetScopeError: named expression cannot rebind comprehension iteration 
variable
>>> res = [(i := 0, j := 1) for i, j in [(1, 2), (3, 4)]]
  File "", line 1
TargetScopeError: named expression cannot rebind comprehension iteration 
variable
>>> res = [(i := i, j := j) for i, j in [(1, 2), (3, 4)]]
  File "", line 1
TargetScopeError: named expression cannot rebind comprehension iteration 
variable
>>> res = [(i := j, j := i) for i, j in [(1, 2), (3, 4)]]
  File "", line 1
TargetScopeError: named expression cannot rebind comprehension iteration 
variable

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-08-04 Thread Nick Coghlan


Nick Coghlan  added the comment:

#37757 now has an associated PR adding the missing TargetScopeError cases: 
https://github.com/python/cpython/pull/15131

There's one case where it goes beyond what the PEP specifies: because the 
outermost iterable expression gets evaluated in a different scope from the rest 
of the comprehension, it just flat out prohibits the use of assignment 
expressions in comprehension iterable expressions.

This was one of the cases where we explicitly didn't want the CPython 
implementation behaviour to leak into the language specification (as name 
binding in the outermost iterable expression would create an unrelated binding 
in the containing scope, while name binding in other iterable expressions would 
rebind any conflicting iteration variable in the comprehension), so the current 
PR takes the more conservative path, and defers allowing name binding in the 
iterable expressions until a specific use case for doing so is presented).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-08-04 Thread Guido van Rossum


Guido van Rossum  added the comment:

Thanks for catching that this was still incomplete.

> Also, a major procedural note: it is NOT OK to merge a PEP implementation 
> that completely ignores parts of the PEP. The merged tests are actively 
> forcing NON-compliance with the accepted PEP, since they're requiring 
> implementations to accept code that the PEP explicitly states should be 
> disallowed.

It was known the implementation was unfinished in this respect, but it was 
deemed better to merge what we had lest the work be lost in merge conflicts, 
and iterate in later betas. I've written some code that uses the walrus 
operator and have found it quite solid. The early existence of an 
implementation (albeit incomplete) has also helped get support for this in mypy 
(https://github.com/python/mypy/pull/6899).

I don't recall being aware that there were tests that specifically *checked* 
that the implementation was incomplete, and that's obviously wrong.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-08-04 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

FWIW, I'm working on an improved whatsnew entry in 
https://github.com/python/cpython/pull/15127

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-08-04 Thread Nick Coghlan


Nick Coghlan  added the comment:

Also, a major procedural note: it is NOT OK to merge a PEP implementation that 
completely ignores parts of the PEP. The merged tests are actively forcing 
NON-compliance with the accepted PEP, since they're requiring implementations 
to accept code that the PEP explicitly states should be disallowed.

Those rules were added because the behaviour in CPython leaks CPython 
implementation details that we *don't want* to be part of the language 
specification.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-08-04 Thread Nick Coghlan


Nick Coghlan  added the comment:

https://bugs.python.org/issue37757 separates out the TargetScopeError handling 
for conflicts between assignment expressions and comprehension iteration 
variables.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-08-04 Thread Nick Coghlan


Nick Coghlan  added the comment:

Did the documentation PR get pushed/merged? Emily mentioned having one in 
progress above, but it doesn't appear in the linked PRs.

--
nosy: +ncoghlan

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-07-15 Thread Barry A. Warsaw


Barry A. Warsaw  added the comment:

I might be missing it, but I think the Language Reference still doesn't 
document assignment expressions.

https://docs.python.org/3/reference/lexical_analysis.html#operators

There are likely other places in the LR that need to be filled out with PEP 572 
documentation.

--
nosy: +barry

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-06-24 Thread miss-islington


miss-islington  added the comment:


New changeset ced9e11931a7a1c5cf4eef08d0dd4a4886723b43 by Miss Islington (bot) 
in branch '3.8':
bpo-35224: Add What's new entry for evaluation order in dict comprehensions 
(GH-14319)
https://github.com/python/cpython/commit/ced9e11931a7a1c5cf4eef08d0dd4a4886723b43


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-06-24 Thread miss-islington


Change by miss-islington :


--
pull_requests: +14178
pull_request: https://github.com/python/cpython/pull/14361

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-06-24 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset b51b7137faa22e12c570c70fe0462c662ccd935e by Pablo Galindo in 
branch 'master':
bpo-35224: Add What's new entry for evaluation order in dict comprehensions 
(GH-14319)
https://github.com/python/cpython/commit/b51b7137faa22e12c570c70fe0462c662ccd935e


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-06-23 Thread miss-islington


miss-islington  added the comment:


New changeset 175b2e974586152c1d4cdea589b971d7ecad4d30 by Miss Islington (bot) 
in branch '3.8':
bpo-35224: Bump the pyc magic number by 1 instead of by 10 in last modification 
(GH-14320)
https://github.com/python/cpython/commit/175b2e974586152c1d4cdea589b971d7ecad4d30


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-06-23 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset b3ca7972c8d8c6479b6542ce28e0f7a6ebd5b8fe by Pablo Galindo in 
branch 'master':
bpo-35224: Bump the pyc magic number by 1 instead of by 10 in last modification 
(GH-14320)
https://github.com/python/cpython/commit/b3ca7972c8d8c6479b6542ce28e0f7a6ebd5b8fe


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-06-23 Thread miss-islington


Change by miss-islington :


--
pull_requests: +14145
pull_request: https://github.com/python/cpython/pull/14321

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-06-23 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
pull_requests: +14144
pull_request: https://github.com/python/cpython/pull/14320

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-06-23 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
pull_requests: +14143
pull_request: https://github.com/python/cpython/pull/14319

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-06-23 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

So issue29652 can be closed now? Was all concerns of previous discussions 
addressed?

I suggest to increment the magic number by 1, not by 10. The space of magic 
numbers is finite.

Add please a What's New entry for this change.

--
nosy: +serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-06-23 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

All buildbots for 3.8 and master are green again :)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-06-22 Thread Guido van Rossum


Guido van Rossum  added the comment:

How are the buildbots doing now?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-06-22 Thread miss-islington


miss-islington  added the comment:


New changeset 5c8b4e2b5de647a67dd1b6414fa520d2b8e973aa by Miss Islington (bot) 
in branch '3.8':
bpo-35224: Bump the pyc magic number after the change in MAP_ADD (GH-14313)
https://github.com/python/cpython/commit/5c8b4e2b5de647a67dd1b6414fa520d2b8e973aa


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-06-22 Thread miss-islington


Change by miss-islington :


--
pull_requests: +14138
pull_request: https://github.com/python/cpython/pull/14315

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-06-22 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 663131a6e2c6c8b83e9f982d8c6ca38fc7c238b4 by Pablo Galindo in 
branch 'master':
bpo-35224: Bump the pyc magic number after the change in MAP_ADD (GH-14313)
https://github.com/python/cpython/commit/663131a6e2c6c8b83e9f982d8c6ca38fc7c238b4


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-06-22 Thread miss-islington


miss-islington  added the comment:


New changeset 874ff65e0a70ff4fd1a67e85cd61d76adfcc219d by Miss Islington (bot) 
in branch '3.8':
bpo-35224: Reverse evaluation order of key: value in dict comprehensions 
(GH-14139)
https://github.com/python/cpython/commit/874ff65e0a70ff4fd1a67e85cd61d76adfcc219d


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-06-22 Thread Guido van Rossum


Guido van Rossum  added the comment:

I don't know why the failure is Windows-only, but I suspect that some of
the cleanup doesn't work there...

This definitely needs a bump of the pyc format version number.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-06-22 Thread miss-islington


Change by miss-islington :


--
pull_requests: +14137
pull_request: https://github.com/python/cpython/pull/14314

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-06-22 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Although it can be related, note that the buildbots do indeed delete pyc files. 
Check for example 
https://buildbot.python.org/all/#/builders/40/builds/2621/steps/2/logs/stdio :

...
Deleting .pyc/.pyo files ...
Deleting test leftovers ...
Using 
"C:\buildbot.python.org\3.x.kloth-win64\build\PCbuild\\..\externals\pythonx86\tools\python.exe"
 (found in externals directory)
Fetching external libraries...
...

But I could be missing something. What I don't understand currently is why it 
fails only on the Windows buildbots.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-06-22 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

I have created PR14313 and triggered a custom build from that PR in the 
buildbots to confirm our hypothesis.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-06-22 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
pull_requests: +14136
pull_request: https://github.com/python/cpython/pull/14313

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-06-22 Thread Guido van Rossum


Guido van Rossum  added the comment:

Ouch. That means we need to buy.p the puck format version number.
-- 
--Guido (mobile)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-06-22 Thread Jörn Heissler

Jörn Heissler  added the comment:

My working theory:

The change modifies the MAP_ADD instruction and also what the instruction 
expects to find on the stack.
When *.pyc files are kept, the code generates the old stack layout (TOS=key, 
TOS1=value), but cpython will assume it's the other way round.

I.e. all *.pyc files created before the change won't work with later cpython 
versions, and vice versa.

I assume the build bots don't remove *.pyc files.

How large an issue is that?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-06-22 Thread Jörn Heissler

Jörn Heissler  added the comment:

Sorry,
I guess that's something completely different.

So maybe the issue is related to my pull request.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-06-22 Thread Jörn Heissler

Jörn Heissler  added the comment:

Pablo,
https://bugs.python.org/issue37359 was created yesterday, i.e. before the merge.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-06-22 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

All the stable 3.x Windows buildbots are failing since 
(https://github.com/python/cpython/pull/14139) was merged:

https://buildbot.python.org/all/#/builders/3/builds/3026
https://buildbot.python.org/all/#/builders/40/builds/2621
https://buildbot.python.org/all/#/builders/12/builds/2766

Extract from the logs:

2 tests failed:
test_asdl_parser test_clinic

 ==
ERROR: test_attributes (test.test_asdl_parser.TestAsdlParser)
--
Traceback (most recent call last):
  File "D:\buildarea\3.x.bolen-windows10\build\lib\test\test_asdl_parser.py", 
line 64, in test_attributes
stmt = self.types['stmt']
KeyError: 'stmt'
==
ERROR: test_constructor_fields (test.test_asdl_parser.TestAsdlParser)
--
Traceback (most recent call last):
  File "D:\buildarea\3.x.bolen-windows10\build\lib\test\test_asdl_parser.py", 
line 72, in test_constructor_fields
ehandler = self.types['excepthandler']
KeyError: 'excepthandler'
==
ERROR: test_definitions (test.test_asdl_parser.TestAsdlParser)
--
Traceback (most recent call last):
  File "D:\buildarea\3.x.bolen-windows10\build\lib\test\test_asdl_parser.py", 
line 54, in test_definitions
self.assertIsInstance(self.types['withitem'], self.asdl.Product)
KeyError: 'withitem'
==
ERROR: test_product (test.test_asdl_parser.TestAsdlParser)
--
Traceback (most recent call last):
  File "D:\buildarea\3.x.bolen-windows10\build\lib\test\test_asdl_parser.py", 
line 58, in test_product
alias = self.types['alias']
KeyError: 'alias'
==
ERROR: test_visitor (test.test_asdl_parser.TestAsdlParser)
--
Traceback (most recent call last):
  File "D:\buildarea\3.x.bolen-windows10\build\lib\test\test_asdl_parser.py", 
line 119, in test_visitor
v.visit(self.types['mod'])
KeyError: 'mod'
==
FAIL: test_module (test.test_asdl_parser.TestAsdlParser)
--
Traceback (most recent call last):
  File "D:\buildarea\3.x.bolen-windows10\build\lib\test\test_asdl_parser.py", 
line 45, in test_module
self.assertIn('stmt', self.types)
AssertionError: 'stmt' not found in {Sum([Construct
--

I cannot reproduce the error locally on my Windows 10 machine, but it fails 
consistently. I made a custom run in one of the buildbots and still fails:

https://buildbot.python.org/all/#/builders/3/builds/3027

--
nosy: +pablogsal

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-06-22 Thread miss-islington

miss-islington  added the comment:


New changeset c8a35417db8853a253517a3e5190e174075c6384 by Miss Islington (bot) 
(Jörn Heissler) in branch 'master':
bpo-35224: Reverse evaluation order of key: value in dict comprehensions 
(GH-14139)
https://github.com/python/cpython/commit/c8a35417db8853a253517a3e5190e174075c6384


--
nosy: +miss-islington

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-06-16 Thread Jörn Heissler

Jörn Heissler  added the comment:

I tried and it appears to work: https://github.com/python/cpython/pull/14139

As I'm not familiar with cpython code, chances are that I missed something 
important.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-06-16 Thread Jörn Heissler

Change by Jörn Heissler :


--
pull_requests: +13980
pull_request: https://github.com/python/cpython/pull/14139

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-06-16 Thread Guido van Rossum

Guido van Rossum  added the comment:

Do you want to give it a try yourself?

On Sun, Jun 16, 2019 at 14:42 Jörn Heissler  wrote:

>
> Jörn Heissler  added the comment:
>
> Hello,
>
> https://www.python.org/dev/peps/pep-0572/#change-to-evaluation-order
> mentions a change of evaluation order for dict comprehensions. It looks
> like this is not implemented yet (as of commit 66d47da8).
>
> Will this be implemented in this issue, or should I create a new one?
>
> Thanks
>
> --
> nosy: +joernheissler
>
> ___
> Python tracker 
> 
> ___
>
-- 
--Guido (mobile)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-06-16 Thread Jörn Heissler

Jörn Heissler  added the comment:

Hello,

https://www.python.org/dev/peps/pep-0572/#change-to-evaluation-order mentions a 
change of evaluation order for dict comprehensions. It looks like this is not 
implemented yet (as of commit 66d47da8).

Will this be implemented in this issue, or should I create a new one?

Thanks

--
nosy: +joernheissler

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-05-07 Thread Chris Angelico


Change by Chris Angelico :


--
pull_requests: +13077

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-04-24 Thread Guido van Rossum


Guido van Rossum  added the comment:

> Maybe we could update the What's New quickly now, and then get the longer 
> more complex docs done later?  People have been asking if this feature is in 
> 3.8 because they don't see it mentioned.

Here it is (PR 12941)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-04-24 Thread Guido van Rossum


Change by Guido van Rossum :


--
pull_requests: +12865

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-04-24 Thread Guido van Rossum


Guido van Rossum  added the comment:

I will add stub sections to the 3.8 whatsnew.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-04-24 Thread Vedran Čačić

Vedran Čačić  added the comment:

... and probably also because they start Python, type

x := 2

and get SyntaxError (as explained above). ;-)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-04-24 Thread Ned Batchelder


Ned Batchelder  added the comment:

Maybe we could update the What's New quickly now, and then get the longer more 
complex docs done later?  People have been asking if this feature is in 3.8 
because they don't see it mentioned.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-04-24 Thread Emily Morehouse


Emily Morehouse  added the comment:

Ned is correct! I will be sprinting on docs for this at PyCon.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-04-24 Thread Ned Batchelder


Ned Batchelder  added the comment:

3.8.0a3 is out, and the What's New still doesn't mention this work yet.

--
nosy: +nedbat

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-03-29 Thread Vedran Čačić

Vedran Čačić  added the comment:

Carol, if you're willing to go into the lion's den that is Python-ideas with 
this, you have my eternal gratitude. :-)

Steven, sorry, there really is no rush. I really don't think I ever said there 
is. However, I think it would be much easier to change the behavior while the 
thing is in alpha. Isn't that the purpose of alpha? 

(If I'm wrong here, please disregard. I would be fine to see this happening few 
years from now. I believe in "Python in the limit", not actual versions, but 
too many times I have been said "what you ask makes sense in the ideal world, 
but that ship has sailed long ago".)

Yes, of course (name := expression) is an improvement over what we have now, 
and I'm grateful for that. It's just that when I explain it to my students (" = 
is just assignment, := is for assignment and displaying"), I have no good 
reason to tell them why they must put the parentheses---except "Python is too 
worried you will make a mistake", and that just doesn't seem like something 
Python usually does. (That's something Java would do to people.:)

Yes, Jupyter sometimes does allow things that would otherwise be SyntaxErrors 
(though much less than they used to, since Python gave them a lot of headache 
by introducing decorators---if you remember that story;), and going to Jupyter 
was the next thing on my mind after I'm rejected here. I just thought it would 
be much easier to just allow this "at the source", so Jupyter people don't have 
to think "what if they finally allow toplevel walruses, but with different 
semantics (e.g., printing result even if it is None)?".

Carol and Victor, I'm sorry I have usurped a bugtracker issue for this 
discussion. First, I really thought this is about implementation of assignment 
expressions, and this is the best place to put it. Second, I didn't expect a 
discussion---I thought it would be either "that makes no sense, go away" or 
"yeah, good idea, we'll do it". For the next such issue (there will probably be 
one:), do you suggest that the more appropriate thing would be to open a new 
issue?

(Let me just reiterate that I'm not going to python-ideas. You probably can't 
understand how stressful that place is, but believe me, it is. I'm not the only 
one that thinks so. If that's the only sanctioned method to improve Python, 
even when it is about details, then I'll just withdraw from the game.)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-03-29 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-03-29 Thread STINNER Victor


STINNER Victor  added the comment:

The bug tracker is not the appropriate place to discuss a PEP. This issue is 
about the implementation of the PEP.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-03-29 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

You are one person, who has used this feature for what, a month elapsed 
time? 300 person-hours actual experience with it? Allowing top-level 
unparenthisized walrus expressions will affect hundreds of thousands of 
people, for collectively millions of hours over a decade or more of 
elapsed time. What's the rush about lifting this restriction?

If the restriction turns out to be "pointless", then we can remove it 
later, and no harm done. You say this is ugly in the notebooks:

(variable := expression)

but it is surely still an improvement over the status quo:

variable = expression; variable

But if we remove it now, and it turns out that it wasn't as pointless as 
you thought, then we're stuck with a design mistake that will be very 
hard to fix without breaking people's code.

I'm glad you've found an excellent use-case for unbracketed assignment 
expressions, and I don't oppose your suggested change, I'm just 
advocating caution.

Besides, Jypiter already allows interactive code that would be a syntax 
error outside of their environment. They can probably relax that 
restriction within Jypiter, while still leaving the language alone.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-03-29 Thread Carol Willing


Carol Willing  added the comment:

@veky As a Jupyter notebook maintainer, I can see your point and I suspect some 
would like it. I'm not sure how big a benefit it would be for folks based on 
current notebook usage and practices. I just don't know. It's worth a 
discussion, but it should take place on python-ideas first to see how much 
traction your proposal would have.

Let's keep this issue focused on the implementation of 572 as accepted.

--
nosy: +willingc

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-03-29 Thread Miro Hrončok

Change by Miro Hrončok :


--
nosy:  -hroncok

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-03-29 Thread Vedran Čačić

Vedran Čačić  added the comment:

Sorry, I don't have the energy for endless discussions without any result that 
almost always happen there. If you - of all people - don't see an obvious 
benefit of this (not even a feature - just a removal of a quite pointless 
limitation), then I'm probably wrong and there's no point in that.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-03-29 Thread Guido van Rossum


Guido van Rossum  added the comment:

@veky -- please take this up on python-ideas.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-03-29 Thread Vedran Čačić

Vedran Čačić  added the comment:

Now I had the opportunity to play with the walrus (as it is affectionately 
called in some parts of the community), I have to ask you for a reconsideration 
of one part of PEP 572.

Unparenthesized assignment expressions are prohibited at the top level of 
an expression statement. This rule is included to simplify the choice for the 
user between an assignment statement and an assignment expression -- there is 
no syntactic position where both are valid.

Correct, but the motivation rests on a wrong premise, that the effect is the 
same. In one very important case, it is not: in REPL (including things like 
Jupyter notebooks), the values of expressions are printed (if not None). I 
really hoped that the walrus would enable me to both assign and see the result 
at once. (Now it does, but I have to parenthesize, and that just looks ugly.)

More than half of the cells in my Jupyter notebooks are of the form

name = some.complicated.method(of={some: arguments})
name

another_name = another.method(name, [additional, arguments])
another_name

And while I understand why I had to write them like this before PEP 572, now I 
really think they would look much tidier as

name := some.complicated.method(of={some: arguments})

another_name := another.method(name, [additional, arguments])

Please reconsider.

--
nosy: +veky

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-02-19 Thread Kubilay Kocak


Change by Kubilay Kocak :


--
nosy: +koobs

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-02-13 Thread STINNER Victor


STINNER Victor  added the comment:

> If anyone has another area they think the documentation should be updated, 
> please let me know!

If we forget something, it's not an issue: it can be added later!

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-02-13 Thread Emily Morehouse


Emily Morehouse  added the comment:

I have a work-in-progress (WIP) documentation branch I've been working on that 
I'll push up this week to address the following:

- Add summary to What's New in Doc/whatsnew/3.8.rst
- Add to list of delimiters in Doc/reference/lexical_analysis.rst
- Add usage documentation in Doc/reference/expressions.rst
- Update FAQ in Doc/faq/design.rst (https://bugs.python.org/issue35666)

If anyone has another area they think the documentation should be updated, 
please let me know!

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-02-13 Thread Miro Hrončok

Miro Hrončok  added the comment:

(I've somehow missed the previous comments about the same, sorry about that.)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-02-13 Thread Miro Hrončok

Miro Hrončok  added the comment:

PEP 572 is nowhere to be found in https://docs.python.org/3.8/whatsnew/3.8.html

Should I open a separate issue for that?

--
nosy: +hroncok

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-02-04 Thread Emily Morehouse


Emily Morehouse  added the comment:

@rhettinger absolutely, I'm going to include that in my documentation PR which 
is currently in progress. :)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-02-04 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

FYI, we need a prominent Whatsnew entry for this.

--
nosy: +rhettinger

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-01-25 Thread STINNER Victor


STINNER Victor  added the comment:

Note: I checked and 3.x buildbots are back to green (ignoring the ones which 
already failed previously). Good.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-01-24 Thread Karthikeyan Singaravelan

Karthikeyan Singaravelan  added the comment:

I don't know if this is the correct issue for questions/clarifications but it 
seems parens are mandatory while using named expressions in while statement 
which makes some of the examples invalid like 
https://www.python.org/dev/peps/pep-0572/#sysconfig-py . From my limited 
knowledge while statement Grammar was not modified at 
https://github.com/python/cpython/pull/10497/files#diff-cb0b9d6312c0d67f6d4aa1966766ceddR73
 and no tests for while statement which made me assume it's intentional. I 
haven't followed the full discussion about PEP 572 so feel free to correct me 
if it's a conscious decision and in that case the PEP 572 can be updated.

# python info

➜  cpython git:(master) ./python.exe
Python 3.8.0a0 (heads/bpo35113-dirty:49329a217e, Jan 25 2019, 09:57:53)
[Clang 7.0.2 (clang-700.1.81)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>

# Example as in PEP 572 to create a simple file that reads itself and prints 
lines that matches "foo"

➜  cpython git:(master) cat /tmp/foo.py
import re

with open("/tmp/foo.py") as f:
while line := f.readline():
if match := re.search(r"foo", line):
print(match.string.strip("\n"))
➜  cpython git:(master) ./python.exe /tmp/foo.py
  File "/tmp/foo.py", line 4
while line := f.readline():
   ^
SyntaxError: invalid syntax

# Wrapping named expression with parens for while makes this valid

➜  cpython git:(master) cat /tmp/foo.py
import re

with open("/tmp/foo.py") as f:
while (line := f.readline()):
if match := re.search(r"foo", line):
print(match.string.strip("\n"))
➜  cpython git:(master) ./python.exe /tmp/foo.py
with open("/tmp/foo.py") as f:
if match := re.search(r"foo", line):


As a user I think parens shouldn't be mandatory in while statement since if 
statement works fine. Parens can cause while statement to be superfluous in 
some cases and an extra case to remember while teaching.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-01-24 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 1396d8fab4d0ae830d45f4937322bbb43ce0c30e by Victor Stinner in 
branch 'master':
bpo-35224: Add support for NamedExpr to unparse.py (GH-11670)
https://github.com/python/cpython/commit/1396d8fab4d0ae830d45f4937322bbb43ce0c30e


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-01-24 Thread STINNER Victor


STINNER Victor  added the comment:

> @vstinner Is there something I could/should have checked other than the CI 
> displayed in GitHub before merging? Let me know if I can help.

It wasn't your fault. Our pre-commit checks on pull requests is incomplete on 
purpose: it has to be fast. It's fine to break buildbots sometimes. It's a 
tradeoff.

If you want to help, please merge https://github.com/python/cpython/pull/11670 
as soon as the CI test pass since I'm going to bed :-)

You are the victim of a very very specific annoying test, test_unparse with its 
annoying "randomly pick 10 files from the stdlib" feature...

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-01-24 Thread Emily Morehouse


Emily Morehouse  added the comment:

@vstinner Is there something I could/should have checked other than the CI 
displayed in GitHub before merging? Let me know if I can help.



Here's a brief summary of the differences between the PEP spec and 
implementation:

>From the "Scope of the target" section of the PEP, there are two cases that 
>should raise a TargetScopeError: when an assignment expression is used in a 
>comprehension inside a class body or for special cases in comprehensions.

Invalid examples for the latter include:

[i := i+1 for i in range(5)]
[[(j := j) for i in range(5)] for j in range(5)]
[i := 0 for i, j in stuff]
[i+1 for i in i := stuff]

However, the following work in the implementation,though the PEP states they 
should be invalid:

>>> [i := i+1 for i in range(5)]
[1, 2, 3, 4, 5]
>>> i
5

>>> [i := 0 for i, j in [(1, 2)]]
[0]

The following does not work in the implementation (as desired), but does not 
throw a TargetScopeError as defined in the PEP:

>>> [i+1 for i in i := range(5)]
File "", line 1
[i+1 for i in i := range(5)]
^
SyntaxError: invalid syntax


IMO, I was leaning towards advocating for changing the PEP to match the 
implementation. I think the error messages are clear and expected, and 
restricting what already works would require significant special cases. I'm 
open to discussion though.

There's also documentation that should certainly be added (and I believe a spot 
where assignment expressions are explicitly mentioned as not being included in 
the language, which is no longer the case)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-01-24 Thread STINNER Victor


STINNER Victor  added the comment:

The change broke most buildbots: congrats Emily, each core dev has to do their 
as part of their training ;-) Don't worry, it's fine.

I wrote PR #11670 which should fix test_tools.

--
nosy: +vstinner

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-01-24 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +11481, 11482

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-01-24 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +11481, 11482, 11483

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-01-24 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +11481

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-01-24 Thread Guido van Rossum


Guido van Rossum  added the comment:

This is huge!

I do recall there are some minor edge cases where the implementation currently 
doesn't match the PEP. Could you summarize those here, and add your 
recommendation (e.g. change the PEP, fix the code, wait and see) with 
motivation?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2019-01-24 Thread Emily Morehouse


Emily Morehouse  added the comment:


New changeset 8f59ee01be3d83d5513a9a3f654a237d77d80d9a by Emily Morehouse in 
branch 'master':
bpo-35224: PEP 572 Implementation (#10497)
https://github.com/python/cpython/commit/8f59ee01be3d83d5513a9a3f654a237d77d80d9a


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: PEP 572 -- Assignment Expressions

2018-11-27 Thread bob gailer

On 11/27/2018 5:48 AM, Ivo Shipkaliev wrote:

Hello.
Maybe it's too late for a discussion, but I just couldn't resist.
I just found out about this new ":=" operator. I need to ask:

What is the need for this additional ":" to the "="?

Did you read the PEP? It answers the question.

Why:
  if (match := pattern.search(data)) is not None:
# Do something with match

What is wrong with:
  if match = pattern.search(data) is not None:
# Do something with match


match = pattern.search(data) is not None

returns True or False, which is then assigned to match. On the other 
hand, in


 (match := pattern.search(data)) is not None
match is assigned the result of the search; then that is compared to None.

I am glad to see this added to python. I first encountered embedded assignment 
in 1969 in the fortran iv compiler for the GE 415 computer. Love at first sight.

--
Bob Gailer

--
https://mail.python.org/mailman/listinfo/python-list


Re: PEP 572 -- Assignment Expressions

2018-11-27 Thread Chris Angelico
On Wed, Nov 28, 2018 at 4:38 AM Ivo Shipkaliev  wrote:
>
>Hello.
>Maybe it's too late for a discussion, but I just couldn't resist.
>I just found out about this new ":=" operator. I need to ask:
>
>What is the need for this additional ":" to the "="?
>Why:
>  if (match := pattern.search(data)) is not None:
># Do something with match
>
>What is wrong with:
>  if match = pattern.search(data) is not None:
># Do something with match
>
>Assignment expression or assignment statement, it's an assignment,
> right? It is very clear to everyone that it's an assignment! Can't it all
> just be a "="?
>Thank you very much!

It's a bug magnet.

https://www.python.org/dev/peps/pep-0572/#why-not-just-turn-existing-assignment-into-an-expression

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


PEP 572 -- Assignment Expressions

2018-11-27 Thread Ivo Shipkaliev
   Hello.
   Maybe it's too late for a discussion, but I just couldn't resist.
   I just found out about this new ":=" operator. I need to ask:

   What is the need for this additional ":" to the "="?
   Why:
 if (match := pattern.search(data)) is not None:
   # Do something with match

   What is wrong with:
 if match = pattern.search(data) is not None:
   # Do something with match

   Assignment expression or assignment statement, it's an assignment,
right? It is very clear to everyone that it's an assignment! Can't it all
just be a "="?
   Thank you very much!


   Kind Regards
   Ivo Shipkaliev
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue35224] PEP 572: Assignment Expressions

2018-11-13 Thread Steven D'Aprano


Change by Steven D'Aprano :


--
nosy: +steven.daprano

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2018-11-12 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +xtreak

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2018-11-12 Thread Eric V. Smith


Change by Eric V. Smith :


--
nosy: +eric.smith

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2018-11-12 Thread Emily Morehouse


Change by Emily Morehouse :


--
keywords: +patch
pull_requests: +9758
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2018-11-12 Thread Emily Morehouse


Change by Emily Morehouse :


--
keywords: +patch, patch
pull_requests: +9758, 9759
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35224] PEP 572: Assignment Expressions

2018-11-12 Thread Emily Morehouse


New submission from Emily Morehouse :

This issue will serve to track development and PRs for the implementation of 
PEP 572: Assignment Expressions.

--
assignee: emilyemorehouse
components: Interpreter Core
messages: 329781
nosy: emilyemorehouse, gvanrossum, tim.peters
priority: normal
severity: normal
status: open
title: PEP 572: Assignment Expressions
type: enhancement
versions: Python 3.8

___
Python tracker 
<https://bugs.python.org/issue35224>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com