[issue12782] Multiple context expressions do not support parentheses for continuation across lines

2020-06-25 Thread thautwarm
thautwarm added the comment: Maybe you should close this. -- ___ Python tracker <https://bugs.python.org/issue12782> ___ ___ Python-bugs-list mailing list Unsub

[issue12782] Multiple context expressions do not support parentheses for continuation across lines

2020-06-25 Thread thautwarm
thautwarm added the comment: I can confirm Guido's words, now parentheses for continuation across lines are already supported. Even without parentheses, multiline with items can be supported. I just implemented it here: https://github.com/thautwarm/cpython/blob/bpo-12782/Grammar

[issue40289] "highlighting" how to get Python's Scripts directory in the documentation

2020-04-14 Thread thautwarm
Change by thautwarm : -- assignee: -> docs@python components: +Documentation nosy: +docs@python versions: +Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issu

[issue40289] "highlighting" how to get Python's Scripts directory in the documentation

2020-04-14 Thread thautwarm
New submission from thautwarm : Currently it's barely impossible for us to search about "How to get where Scripts directory/folder is". If we google this, we can only get answers about '__file__', which is far from the expectation. The correct information lies on - https://github.

[issue32352] `inspect.getfullargspec` doesn't work fine for some builtin callable objects

2020-02-18 Thread thautwarm
Change by thautwarm : -- stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue32352> ___ ___ Python-bugs-list

[issue39677] 3.6+ documentation for MAKE_FUNCTION

2020-02-18 Thread thautwarm
Change by thautwarm : -- pull_requests: +17930 pull_request: https://github.com/python/cpython/pull/18550 ___ Python tracker <https://bugs.python.org/issue39

[issue39677] 3.6+ documentation for MAKE_FUNCTION

2020-02-18 Thread thautwarm
Change by thautwarm : -- keywords: +patch pull_requests: +17929 stage: needs patch -> patch review pull_request: https://github.com/python/cpython/pull/18549 ___ Python tracker <https://bugs.python.org/issu

[issue39677] 3.6+ documentation for MAKE_FUNCTION

2020-02-18 Thread thautwarm
thautwarm added the comment: Okay, I'll make a PR. It's okay because users will always check docs of version 3 instead of a specific version like 3.6. -- ___ Python tracker <https://bugs.python.org/issue39

[issue39677] 3.6+ documentation for MAKE_FUNCTION

2020-02-18 Thread thautwarm
New submission from thautwarm : LINK: https://docs.python.org/3.6/library/dis.html?highlight=bytecode#opcode-MAKE_FUNCTION To avoid being confusing, MAKE_FUNCTION(argc) shall be MAKE_FUNCTION(flag), since 3.6 the operand of MAKE_FUNCTION never means `argcount`. -- assignee: docs

[issue34850] Emit a syntax warning for "is" with a literal

2019-12-19 Thread thautwarm
thautwarm added the comment: Thanks. However, unfortunately, this warning seems impossible to suppress. Use following example: import warnings warnings.filterwarnings('ignore') warnings.warn(SyntaxWarning("test")) def f(x): return x is 5 print(f(5)) I

[issue34850] Emit a syntax warning for "is" with a literal

2019-11-17 Thread thautwarm
thautwarm added the comment: What if using identity equality on integer literals is intended? I'm now trying to speed up the generated code via the integer interning mechanism told by https://docs.python.org/3/c-api/long.html#c.PyLong_FromLong . I think it okay to not complain when

[issue35632] support unparse for Suite ast

2019-01-01 Thread thautwarm
New submission from thautwarm : Although `Suite` is not an actual AST used in CPython, it's quite useful when performing some code analysis. `Suite` is a sequence of statements which could be used to represent a block whose context inherits from outside block's. Also, the document said

[issue35001] ImportFrom level cannot be optional

2018-10-17 Thread thautwarm
thautwarm added the comment: Firstly, allowing to construct ImportFrom without `level` specified could be the result of referring Python-asdl. Secondly, in C level, `level` is always an integer. Last but not the least, when you can access `level` from an ImportFrom AST, it must

[issue12782] Multiple context expressions do not support parentheses for continuation across lines

2018-10-17 Thread thautwarm
thautwarm added the comment: How about: with_stmt: 'with' (with_items | '(' with_items ')') ':' suite ignored: INDENT | NEWLINE | DEDENT with_items: with_item (ignored* ',' ignored* with_item)* -- nosy: +thautwarm ___ Python tracker <ht

[issue35001] ImportFrom level cannot be optional

2018-10-17 Thread thautwarm
thautwarm added the comment: @Anthony > I don't think mypy has an annotation for "sometimes has an attribute" Yes.. The annotation for an attribute that **maybe exist** cannot be expressed by mypy.. -- ___ Python tr

[issue35001] ImportFrom level cannot be optional

2018-10-17 Thread thautwarm
thautwarm added the comment: Hi, Serhiy, for Python-asdl has made `level` able to optional, certainly we could construct an ImportFrom AST without giving `level`. Moreover, this might evidence that `level` cannot be optional in fact: https://github.com/python/cpython/blob

[issue35001] ImportFrom level cannot be optional

2018-10-16 Thread thautwarm
New submission from thautwarm : This issue is found from a type hinting problem: ``` class ImportFrom(stmt): class ImportFrom(stmt): module = ... # type: Optional[_identifier] module = ... # type: Optional[_identifier] names = ... # type: typing.List[alias] names

[issue34953] Implement `mmap.mmap.__repr__`

2018-10-16 Thread thautwarm
thautwarm added the comment: I think it depends on the use case. If `repr` wouldn't be invoked except debugging,some IO operations might not be that bad. I'm to make some adjustments to avoid displaying the contents if nothing evidence that IO operations is not bad

[issue34953] Implement `mmap.mmap.__repr__`

2018-10-15 Thread thautwarm
thautwarm added the comment: @Ram Rachum Yes yes yes, actually the entire contents will be truncated when its length is bigger than a specific integer(now it's 50). For we use `...` to represent the ignored contents, `start ... end` could also be called *entire_contents

[issue34953] Implement `mmap.mmap.__repr__`

2018-10-15 Thread thautwarm
Change by thautwarm : -- keywords: +patch pull_requests: +9254 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue34953> ___ ___ Python-

[issue34953] Implement `mmap.mmap.__repr__`

2018-10-15 Thread thautwarm
thautwarm added the comment: How about this: ``` # opened # closed ``` -- nosy: +thautwarm ___ Python tracker <https://bugs.python.org/issue34953> ___ ___

[issue34880] About the "assert" bytecode

2018-10-09 Thread thautwarm
thautwarm added the comment: Hi, Serhiy, there could be an another way to fix all this sort of problems IMO. We can figure out all the cases that implicitly require shadow builtins, and then change symtable visitor to add corresponding free variables with name mangling, for instance: 1

[issue34880] About the "assert" bytecode

2018-10-03 Thread thautwarm
thautwarm added the comment: Reply to this: > How is that different from every other case of shadowing a builtin? > > len = 45 > print(len("hello world")) ``` AssertionError = 42 assert 1 != 2 ``` `assert` implicitly invokes `AssertionError`, while `len

[issue34880] About the "assert" bytecode

2018-10-03 Thread thautwarm
thautwarm added the comment: If we could generate `LOAD_CONST` instructions for `assert` statements, any prospective dangers could be avoided. ``` from dis import dis @dis def f(): assert x 3 0 LOAD_GLOBAL 0 (x) 2 POP_JUMP_IF_TRUE 8

[issue34880] About the "assert" bytecode

2018-10-03 Thread thautwarm
thautwarm added the comment: Steven, this problem is quite interesting because it just allows users to cause fatal errors without any invalid operations. ``` AssertionError = 1 assert 1 == 2, 2 --- TypeError: 'int

[issue34845] allow exprlist as the iterators of comprehensions to be consistent with for statements

2018-09-29 Thread thautwarm
thautwarm added the comment: Well, sorry for that. -- ___ Python tracker <https://bugs.python.org/issue34845> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue34845] allow exprlist as the iterators of comprehensions to be consistent with for statements

2018-09-29 Thread thautwarm
Change by thautwarm : -- components: +Interpreter Core type: -> behavior versions: +Python 3.8 ___ Python tracker <https://bugs.python.org/issue34845> ___ _

[issue34845] allow exprlist as the iterators of comprehensions to be consistent with for statements

2018-09-29 Thread thautwarm
New submission from thautwarm : Currently we can use `exprlist` as the iterator in a `for` statement: ``` for i in 1, 2,: print(i) 1 2 ``` However, when it comes to comprehension expressions: ``` [i for i in 1, 2] SyntaxError: invalid syntax ``` I know

[issue32892] Remove specific constant AST types in favor of ast.Constant

2018-09-22 Thread thautwarm
thautwarm added the comment: Thank you, Serhiy. I learned python ast through ast.parse and pretty print, which prevented me from knowing this useful one. In fact, I wonder if we could support more species of constant values accepted by ast.Constant

[issue32892] Remove specific constant AST types in favor of ast.Constant

2018-09-21 Thread thautwarm
thautwarm added the comment: I'm in favor of this idea for prospective extensions that could be implemented through this brand-new ast.Constant. Actually I used to expect a more general ast.Constant when I was manipulating ASTs half a year ago, at that time my job is to make staging

[issue32352] `inspect.getfullargspec` doesn't work fine for some builtin callable objects

2018-09-21 Thread thautwarm
thautwarm added the comment: Maybe a few adjustments to this one? -- ___ Python tracker <https://bugs.python.org/issue32352> ___ ___ Python-bugs-list mailin

[issue32352] `inspect.getfullargspec` doesn't work fine for some builtin callable objects

2017-12-17 Thread thautwarm
New submission from thautwarm <yaoxiansa...@gmail.com>: It's quite confusing to me that `inspect.getfullargspec` crashed when it was applied on some builtin callable objects. ``` for each in __builtin__.__dict__: try: obj = getattr(__builtin__, each) if not callab