Ilya Kamenshchikov added the comment:
Changing behavior and it's impact on existing code is, without a doubt, a
big deal here. Maybe it's a reason not to do anything about it.
Just to understand guiding design principle, what is expected from __str__
in more general case? I thought a
Ilya Kamenshchikov added the comment:
That's a solution, except you must know ahead of time this issue exists.
Best Regards,
--
Ilya Kamen
On Tue, Aug 4, 2020 at 6:59 PM Rémi Lapeyre wrote:
>
> Rémi Lapeyre added the comment:
>
> Hi, can you not use its repr:
>
New submission from Ilya Kamenshchikov :
I have a high level wrapper where I am catching expection and present it in
(more) user-friendly format with a message.
try:
raise ValueError
except Exception as e:
print(f"Following happened: {e}")
>>> prints "Fo
New submission from Ilya Kamenshchikov :
Most usual usecase for format_spec is to specify it as a constant, that would
be logical to represent as ast.Constant. However, ast.parse wraps value of
ast.FormattedValue.format_spec into a JoinedStr with a single constant value,
as can be seen from
New submission from Ilya Kamenshchikov :
In a few of my projects I had this (minor) pain of having to remember which
collections of elements are sets and which are [list, tuple]. It causes me to
double check and have random.sample(my_set, 1)[0] in many places.
To me this is not how I think
New submission from Ilya Kamenshchikov :
While trying to construct a valid ast node programmatically, I have tried
following:
import ast
tree = ast.BinOp(left=ast.Num(n=2), right=ast.Num(n=2), op=ast.Add())
expr = ast.Expression(body=[tree])
ast.fix_missing_locations(expr)
exe = compile
Ilya Kamenshchikov added the comment:
Py3.6+ f-strings support any indexing as they actually evaluate python
expressions.
>>> a = ['Java', 'Python']
>>> var = f"Hello {a[-1]}"
Hello Python
--
nosy: +Ilya Kamenshchikov
__
Ilya Kamenshchikov added the comment:
The wording from Carol Willing makes it read simpler. Also in the next
sentence, 'test-directed development' goes under the name 'test-driven
development' as of 2019 (search in google ->
https://en.wikipedia.org/wiki/Test-driv
Change by Ilya Kamenshchikov :
--
keywords: +patch
pull_requests: +14525
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/14730
___
Python tracker
<https://bugs.python.org/issu
Ilya Kamenshchikov added the comment:
Same problem holds for tabs (\\t vs \t).
For \\r vs \r, it is even more fun:
txt1 = '"""\\r"""'
txt2 = '"""\r"""'
>>> b'\r'
>>> b&
New submission from Ilya Kamenshchikov :
parsing two different strings produces identical ast.Str nodes:
import ast
txt1 = '"""\\n"""'
txt2 = '"""\n"""'
tree1 = ast.parse(txt1)
tree2 = ast.parse(txt2)
print(t
Ilya Kamenshchikov added the comment:
please fix spent half a day to understand I need C compiler
--
nosy: +Ilya Kamenshchikov
___
Python tracker
<http://bugs.python.org/issue2
12 matches
Mail list logo