[issue38556] Walrus operator in list comprehensions [Python 3.8.0]

2020-07-11 Thread Anselm Kiefner
Anselm Kiefner added the comment: I just stumbled over this same restriction and when I googled for "SyntaxError: cannot assign to named expression", 0 actual results showed - an absolute unicorn for a Python error. > "Due to design constraints in the reference implemen

[issue30793] Parsing error on f-string-expressions containing strings with backslash

2017-09-07 Thread Anselm Kiefner
Anselm Kiefner added the comment: Heh. I had a hunch it could be jupyter specific, but didn't test it. They had problems with f-strings before, it seems they over-fixed those .. Maybe you want to check their implementation and see if it's any good for a general solution? Otherwise I'd

[issue30793] Parsing error on f-string-expressions containing strings with backslash

2017-09-07 Thread Anselm Kiefner
Anselm Kiefner added the comment: Hey Eric, just a heads up. In the latest jupyter notebook, this is valid code: f"{eval('bool(0)\ and True\ ')}" which returns 'False' I don't know how far you want to go, but if someone REALLY wants to use backspace in f-strings just fo

[issue30793] Parsing error on f-string-expressions containing strings with backslash

2017-06-28 Thread Anselm Kiefner
New submission from Anselm Kiefner: Considering that x = 3 f"{'hello' if x == 3 else 'goodbye'} world" is a simple, elegant and powerful piece of code that works just as expected by itself, I often find myself stumbling and wondering why f"text {'\n' if x == 3 else ''} text&q

[issue27984] singledispatch is wonky with enums

2016-09-06 Thread Anselm Kiefner
New submission from Anselm Kiefner: from functools import singledispatch from enum import Enum IS = Enum("IS", "a, b") @singledispatch def foo(x): print(foo.dispatch(x)) print("foo") @foo.register(IS.a) def bar(x): print(foo.dispatch(x)) print