[issue24136] document PEP 448
Konstantin Molchanov added the comment: Hi! I'd like to update the docs with the examples of the new syntax usage. This is my first contribution to the Python docs, so I'd like to ask for some assistance. I'm going to start with adding an example to the tutorial (https://docs.python.org/3.5/tutorial/introduction.html#lists). I wanted to demonstrate the new syntax with string too (https://docs.python.org/3.5/tutorial/introduction.html#strings), but it turned out to produce somewhat unexpected results: >>> s = 'And now' >>> first, *rest = s >>> # I expected it to be synonymous >>> # to ``first, rest = s[0], s[1:]`` >>> # ``first`` is expected to be 'A', >>> # ``rest`` is expected to be 'nd now'. >>> # ``first`` is 'A', as expected: >>> first 'A' >>> # But ``rest`` is implicitly turned into a list: >>> rest ['n', 'd', ' ', 'n', 'o', 'w', ' ', 'f', 'o', 'r', ' ', 's', 'o', 'm', 'e', 't', 'h', 'i', 'n', 'g', ' ', 'c', 'o', 'm', 'p', 'l', 'e', 't', 'e', 'l', 'y', ' ', 'd', 'i', 'f', 'f', 'e', 'r', 'e', 'n', 't'] Is this behavior intended? Why wasn't ``first`` converted into ['A'] as well? Am I just not supposed to use the new unpacking with strings? Thanks, Konstantin -- nosy: +moigagoo ___ Python tracker <http://bugs.python.org/issue24136> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24136] document PEP 448: unpacking generalization
Konstantin Molchanov added the comment: @vadmium thanks for the assistance! I'll kick off with the reference then. P.S. Am I the only one who doesn't receive any emails from the tracker? I never got the registration link or a follow-up notification from this issue. Am I missing something? P.P.S. I'm not yet familiar with the local etiquette, so please forgive me if I'm unintentionally breaking some rules. Is @mentioning OK? -- ___ Python tracker <http://bugs.python.org/issue24136> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24136] document PEP 448: unpacking generalization
Konstantin Molchanov added the comment: I've updated the Calls syntax reference in reference/expressions and the assignment object description in reference/simple_stmts. Please tell me if I'm generally doing OK. If I'm not, please guide me to the right direction. -- Added file: http://bugs.python.org/file39918/reference_calls_syntax_update.diff ___ Python tracker <http://bugs.python.org/issue24136> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24136] document PEP 448: unpacking generalization
Changes by Konstantin Molchanov : Added file: http://bugs.python.org/file39919/replace_sequence_with_iterable.diff ___ Python tracker <http://bugs.python.org/issue24136> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24754] argparse add_argument with action="store_true", type=bool should not crash
Konstantin Molchanov added the comment: Although I agree that specifying type with store_true or store_false is unnecessary, this shouldn't really be an error like this. Why not just ignore type if it can't be utilized? The error message implies the usage of add_argument is erroneous, however it is fully compatible with the spec give in the docs. Alternatively, the docs should be updated. -- nosy: +moigagoo ___ Python tracker <http://bugs.python.org/issue24754> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com