[issue38624] pathlib .suffix, .suffixes, .stem unexpected behavior for pathname with trailing dot
New submission from Inyeol Lee : Python3.8 pathlib treats dot between path stem and suffix as part of suffix in general: >>> a = pathlib.Path('foo.txt') >>> a.stem, a.suffix ('foo', '.txt') >>> a.with_suffix('') PosixPath('foo') However, if pathname ends with dot, it treats the trailing dot as part of stem, not part of suffix: >>> b = pathlib.Path('bar.') >>> b.stem, b.suffix ('bar.', '') This looks like a bug. It should return ('bar', '.'). There are couple of unexpected behavior related to this: >>> pathlib.Path('foo.txt').with_suffix('.') ... ValueError: Invalid suffix '.' <== Why not PosixPath('foo.') ? >>> c = pathlib.Path('foo..') >>> c.stem, c.suffix, c.suffixes ('foo..', '', []) I think above should return ('foo.', '.', ['.', '.']) Tested with macOS 10.15 and Python3.8. Python3.7 behaves the same. -- components: Library (Lib) messages: 355600 nosy: inyeollee priority: normal severity: normal status: open title: pathlib .suffix, .suffixes, .stem unexpected behavior for pathname with trailing dot type: behavior versions: Python 3.8 ___ Python tracker <https://bugs.python.org/issue38624> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16319] optional comma inside function argument list triggers syntax error
New submission from Inyeol Lee: Ubuntu 12.04, python 3.2.3 Optional trailing comma causes syntax error if used for keyword-only argument list: These are OK -- def f(a, b,): pass def f(a, b=None,): pass These triggers syntax error -- def f(a, *, b,): pass def f(a, *, b=None,): pass python 3.1 and 3.2 shows this error, not tested for 3.3 yet. -- components: Interpreter Core messages: 173735 nosy: Inyeol.Lee priority: normal severity: normal status: open title: optional comma inside function argument list triggers syntax error type: behavior versions: Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16319 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10544] yield expression inside generator expression does nothing
New submission from Inyeol Lee inyeol@gmail.com: Simple coroutine with for loop works: def pack_a(): while True: L = [] for i in range(2): L.append((yield)) print(L) pa = pack_a() next(pa) pa.send(1) pa.send(2) [1, 2] If using list comprehension (generator expression), it fails: def pack_b(): while True: L = [(yield) for i in range(2)] print(L) pb = pack_b() endless loop here I understand what's going on here - generator expression is converted to nested function and there's no way to either stop the execution inside nested function (since it's not started yet!) or send() a value to its yield expression. Still I think this behavior is a bug and needs fixed. - best fix would make it behave the same as for loop. - if it's not fixable, yield expression inside genexp should not be allowed. -- components: Interpreter Core messages: 122475 nosy: Inyeol.Lee priority: normal severity: normal status: open title: yield expression inside generator expression does nothing type: behavior versions: Python 3.1 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10544 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1184112] Missing trailing newline with comment raises SyntaxError
Inyeol Lee [EMAIL PROTECTED] added the comment: Missing trailing newline still triggers error as of 2.5.1: import parser parser.suite(pass\n ) IndentationError: unexpected indent parser.suite(if True:\n pass\n ) SyntaxError: invalid syntax -- nosy: +inyeollee _ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1184112 _ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com