[issue41478] Empty representation of AssertionError

2020-08-06 Thread Ilya Kamenshchikov
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 about

[issue41478] Empty representation of AssertionError

2020-08-06 Thread Ilya Kamenshchikov
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: > >

[issue41478] Empty representation of AssertionError

2020-08-04 Thread Ilya Kamenshchikov
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

[issue39760] ast.FormattedValue.format_spec unnecessarily wrapped in JoinedStr

2020-02-26 Thread Ilya Kamenshchikov
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

[issue39626] random choice to delegate to sample on sets

2020-02-13 Thread Ilya Kamenshchikov
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

[issue38131] compile(mode='eval') uninformative error message

2019-09-12 Thread Ilya Kamenshchikov
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

[issue7951] Should str.format allow negative indexes when used for __getitem__ access?

2019-07-13 Thread Ilya Kamenshchikov
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 __

[issue37352] Typo in documentation: "to making it easy"

2019-07-13 Thread 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-driven_development). I h

[issue37352] Typo in documentation: "to making it easy"

2019-07-13 Thread Ilya Kamenshchikov
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

[issue37182] ast - handling new line inside a string

2019-06-06 Thread Ilya Kamenshchikov
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'\n' -- _

[issue37182] ast - handling new line inside a string

2019-06-06 Thread Ilya Kamenshchikov
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(tree1.body[0].value.s

[issue2943] Distutils should generate a better error message when the SDK is not installed

2016-01-01 Thread Ilya Kamenshchikov
Ilya Kamenshchikov added the comment: please fix spent half a day to understand I need C compiler -- nosy: +Ilya Kamenshchikov ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/