[issue32954] Lazy Literal String Interpolation (PEP-498-based fl-strings)

2019-12-17 Thread Mateusz Bysiek


Change by Mateusz Bysiek :


--
nosy: +mbdevpl

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



[issue29715] Argparse improperly handles "-_"

2017-03-15 Thread Mateusz Bysiek

Changes by Mateusz Bysiek <r...@mbdev.pl>:


--
title: Arparse improperly handles "-_" -> Argparse improperly handles "-_"

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



[issue28964] AST literal_eval exceptions provide no information about line number

2017-03-15 Thread Mateusz Bysiek

Changes by Mateusz Bysiek <r...@mbdev.pl>:


--
nosy: +mbdevpl

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



[issue10399] AST Optimization: inlining of function calls

2017-03-15 Thread Mateusz Bysiek

Changes by Mateusz Bysiek <r...@mbdev.pl>:


--
nosy: +mbdevpl

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



[issue11549] Build-out an AST optimizer, moving some functionality out of the peephole optimizer

2017-03-15 Thread Mateusz Bysiek

Changes by Mateusz Bysiek <r...@mbdev.pl>:


--
nosy: +mbdevpl

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



[issue29471] AST: add an attribute to FunctionDef to distinguish functions from generators and coroutines

2017-03-15 Thread Mateusz Bysiek

Changes by Mateusz Bysiek <r...@mbdev.pl>:


--
nosy: +mbdevpl

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



[issue24119] Carry comments with the AST

2017-03-15 Thread Mateusz Bysiek

Mateusz Bysiek added the comment:

For some time now, there's an alternate ast implementation 
https://github.com/python/typed_ast that carries PEP 484 type comments with the 
AST as attributes of certain nodes.

Their approach is described here: 
https://github.com/python/typed_ast/blob/master/typed_ast/ast3.py#L5

If type comments become mainstream in Python, could this approach maybe be 
adopted as official Python AST at some point?

--
nosy: +mbdevpl

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



[issue29051] Improve error reporting involving f-strings (PEP 498)

2017-03-15 Thread Mateusz Bysiek

Changes by Mateusz Bysiek <r...@mbdev.pl>:


--
nosy: +mbdevpl

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



[issue29814] parsing f-strings -- opening brace of expression gets duplicated when preceeded by backslash

2017-03-15 Thread Mateusz Bysiek

New submission from Mateusz Bysiek:

with Python 3.6.0 and the following script:

```
#!/usr/bin/env python3.6

import ast

code1 = '''"\\{x}"'''
code2 = '''f"\\{x}"'''

tree1 = ast.parse(code1, mode='eval')
print(ast.dump(tree1))
tree2 = ast.parse(code2, mode='eval')
print(ast.dump(tree2))
```

I get the following output:

```
Expression(body=Str(s='\\{x}'))
Expression(body=JoinedStr(values=[Str(s='\\{'), 
FormattedValue(value=Name(id='x', ctx=Load()), conversion=-1, 
format_spec=None)]))
```

Therefore, the normal string is `'\\{x}'`.
But the f-string has two parts: `'\\{'` and an expression `Name(id='x', 
ctx=Load())`.

Where does the `{` in the string part of f-string come from? I can't believe 
this is the intended behavior... Or, is it?

When I escape the backslash once like above, what gets parsed is actually 
unescaped backslash. So this might just boil down to inconsistency in parsing 
`\{` in normal vs. f-strings.

I originally discovered this in typed_ast 
https://github.com/python/typed_ast/issues/34 but the behaviour of ast is 
identical and since developers of typed_ast aim at compatibility with ast, I 
bring this issue here.

--
components: Library (Lib)
messages: 289642
nosy: mbdevpl
priority: normal
severity: normal
status: open
title: parsing f-strings -- opening brace of expression gets duplicated when 
preceeded by backslash
type: behavior
versions: Python 3.6

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