[issue1107] [patch] 2to3, lambda with non-tuple argument inside parenthesis
New submission from Jeong-Min Lee: lambda (x): x should be transformed to lambda x: x not lambda x1: x1[0] -- components: Demos and Tools files: 2to3_lambda_nontuple_param.diff messages: 55654 nosy: falsetru, gvanrossum severity: normal status: open title: [patch] 2to3, lambda with non-tuple argument inside parenthesis __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1107> __Index: tests/test_fixers.py === --- tests/test_fixers.py (revision 57982) +++ tests/test_fixers.py (working copy) @@ -1527,6 +1527,16 @@ s = """lambda x: x + 5""" self.unchanged(s) +def test_lambda_single_nontuple_argument_inside_parenthesis(self): +b = """lambda (x): x""" +a = """lambda x: x""" +self.check(b, a) + +def test_lambda_single_tuple_argument_inside_parenthesis(self): +b = """lambda (x,): x""" +a = """lambda x1: x1[0]""" +self.check(b, a) + def test_lambda_simple(self): b = """lambda (x, y): x + f(y)""" a = """lambda x_y: x_y[0] + f(x_y[1])""" Index: fixes/fix_tuple_params.py === --- fixes/fix_tuple_params.py (revision 57982) +++ fixes/fix_tuple_params.py (working copy) @@ -99,6 +99,12 @@ body = results["body"] params = find_params(args) +if not isinstance(params, list): +new_param = Name(params) +new_param.set_prefix(args.get_prefix()) +args.replace(new_param.clone()) +return + to_index = map_to_index(params) tup_name = self.new_name(tuple_name(params)) ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1107] [patch] 2to3, lambda with non-tuple argument inside parenthesis
Jeong-Min Lee added the comment: I found this while 2to3ing BeautifulSoup.py. __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1107> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1411] A typo in tutorial
New submission from Jeong-Min Lee: In the middle of "3.1.4 Lists", it reads as follow - >>> a [] The built-in function len() also applies to lists: >>> len(a) 8 - but it should be .. - >>> a [] The built-in function len() also applies to lists: >>> len(a) 0 - http://docs.python.org/tut/node5.html#SECTION00514 -- components: Documentation messages: 57295 nosy: falsetru severity: urgent status: open title: A typo in tutorial versions: Python 2.5 __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1411> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10109] itertools.product with infinite iterator cause MemoryError.
New submission from Jeong-Min Lee : According to the documentation, itertools.product is equivalent to nested for-loops in a generator expression. But, itertools.product(itertools.count(2010)) is not. >>> import itertools >>> (year for year in itertools.count(2010)) at 0x026367D8> >>> itertools.product(itertools.count(2010)) Traceback (most recent call last): File "", line 1, in MemoryError -- components: Library (Lib) messages: 118735 nosy: falsetru priority: normal severity: normal status: open title: itertools.product with infinite iterator cause MemoryError. type: behavior versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2 ___ Python tracker <http://bugs.python.org/issue10109> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11944] Function call with * and generator hide exception raised by generator.
New submission from Jeong-Min Lee : Expected "TypeError: cannot concatenate 'str' and 'int' objects" exception raised, but got following result. >>> def g(): ... '1' + 0 ... yield 1, 2 ... yield 3, 4 ... >>> zip(*g()) Traceback (most recent call last): File "", line 1, in TypeError: zip() argument after * must be a sequence, not generator >>> (lambda xs: 0)(*g()) Traceback (most recent call last): File "", line 1, in TypeError: () argument after * must be a sequence, not generator >>> list(*g()) Traceback (most recent call last): File "", line 1, in TypeError: type object argument after * must be a sequence, not generator >>> list(g()) Traceback (most recent call last): File "", line 1, in File "", line 2, in g TypeError: cannot concatenate 'str' and 'int' objects -- components: Interpreter Core messages: 134632 nosy: falsetru priority: normal severity: normal status: open title: Function call with * and generator hide exception raised by generator. type: behavior versions: Python 2.7, Python 3.3 ___ Python tracker <http://bugs.python.org/issue11944> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11944] Function call with * and generator hide exception raised by generator.
Changes by Jeong-Min Lee : -- versions: +Python 3.2 -Python 3.3 ___ Python tracker <http://bugs.python.org/issue11944> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11944] Function call with * and generator hide exception raised by generator.
Jeong-Min Lee added the comment: Some exceptions are reported correctly. >>> def g(): ... 1 / 0 ... yield 1, 2 ... yield 3, 4 ... >>> zip(*g()) Traceback (most recent call last): File "", line 1, in File "", line 2, in g ZeroDivisionError: integer division or modulo by zero >>> def g(): ... [][0] ... yield 1, 2 ... yield 3, 4 ... >>> zip(*g()) Traceback (most recent call last): File "", line 1, in File "", line 2, in g IndexError: list index out of range -- ___ Python tracker <http://bugs.python.org/issue11944> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10169] socket.sendto raises incorrect exception when passed incorrect types
Changes by Jeong-Min Lee : -- nosy: +falsetru ___ Python tracker <http://bugs.python.org/issue10169> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1195] Problems on Linux with Ctrl-D and Ctrl-C during raw_input
Changes by Jeong-Min Lee : -- nosy: +falsetru ___ Python tracker <http://bugs.python.org/issue1195> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6316] format, str.format don't work well with datetime, date object
New submission from Jeong-Min Lee : format(datetime_obj, format_string) return format_string. (when format_string is not empty.) >>> import datetime >>> d = datetime.datetime.now() >>> format(d) '2009-06-20 23:51:54.243428' >>> format(d, '') '2009-06-20 23:51:54.243428' >>> d datetime.datetime(2009, 6, 20, 23, 51, 54, 243428) >>> '{0}'.format(d) '2009-06-20 23:51:54.243428' >>> '{0:30}'.format(d) # odd '30' >>> format(d, '30') # odd '30' >>> format(str(d), '30') # workaround '2009-06-20 23:51:54.243428' >>> '{0!s:30}'.format(d) # workaround '2009-06-20 23:51:54.243428' -- components: Extension Modules, Library (Lib) messages: 89539 nosy: falsetru severity: normal status: open title: format, str.format don't work well with datetime, date object type: behavior versions: Python 2.6, Python 2.7, Python 3.0, Python 3.1 ___ Python tracker <http://bugs.python.org/issue6316> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6316] format, str.format don't work well with datetime, date object
Jeong-Min Lee added the comment: I got it. By the way, It would be good to document that this behaviour (at least about datetime.__format__) -- ___ Python tracker <http://bugs.python.org/issue6316> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7483] str.format behaviour changed from Python 2.6
New submission from Jeong-Min Lee : In Python 2.6, >>> '{0:0<30}'.format(1) '10' >>> '{0:-<30}'.format(1) '1-' In Python 2.7a / 3.1, >>> '{0:0<30}'.format(1) '01' >>> '{0:-<30}'.format(1) '1-' -- components: Interpreter Core messages: 96282 nosy: falsetru severity: normal status: open title: str.format behaviour changed from Python 2.6 type: behavior versions: Python 2.7, Python 3.1 ___ Python tracker <http://bugs.python.org/issue7483> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6902] Built-in types format incorrectly with 0 padding.
Changes by Jeong-Min Lee : -- nosy: +falsetru ___ Python tracker <http://bugs.python.org/issue6902> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5879] multiprocessing - example "pool of http servers " fails on windows "socket has no attribute fromfd"
Changes by Jeong-Min Lee : -- nosy: +falsetru ___ Python tracker <http://bugs.python.org/issue5879> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com