[issue1580] Use shorter float repr when possible
Ole Laursen added the comment: Just came across this bug, I don't want to reopen this or anything, but regarding the SSE2 code I couldn't help thinking that why can't you just detect the presence of SSE2 when the interpreter starts up and then switch implementations based on that? I think that's what liboil does (http://liboil.freedesktop.org/wiki/). -- nosy: +olau ___ Python tracker <http://bugs.python.org/issue1580> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7257] Improve documentation of list.sort and sorted()
Ole Laursen added the comment: Okay. I can only say that while the current docstrings are likely good reminders for you, knowing Python in and out, they were pretty useless to me as documentation, which I believe docstrings should be, they're called docstrings, after all, not reminderstrings. :) I fail to see how including more info can hurt in any way, you're not forced to read it if you don't need it, so I hope you (or somebody else) will reconsider at some point. -- ___ Python tracker <http://bugs.python.org/issue7257> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7359] mailbox cannot modify mailboxes in system mail spool
Ole Laursen added the comment: Just got bitten by this too. Renaming is good and all, but as far as I can tell, it will never work with the system spool. It's not just that you can't create a temporary file in the directory, you can't rename files into it either. If I create an empty file somewhere and try to rename it to overwrite my mailbox, I get a permission denied. Sad. :( So I think you have to bite the bullet and write directly to the file. Either that or define that the module can't be used to work with system spool mailboxes, at least on Debian. But that would be even more sad. -- nosy: +olau ___ Python tracker <http://bugs.python.org/issue7359> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7035] codecs error handlers lack documentation
New submission from Ole Laursen : import codecs help(codecs.replace_errors) results in replace_errors(...) (END) in Python 2.6. Interestingly, http://docs.python.org/library/codecs actually says "Implements the replace error handling." Which is pretty useless, though. :) Suggest at least copying the parenthesized notes in the next-to-last paragraph under codecs.register to the docstrings. I was looking for docs in the hope of finding something fancy ala converting æ to ae, alas no cigar. -- assignee: georg.brandl components: Documentation messages: 93445 nosy: georg.brandl, olau severity: normal status: open title: codecs error handlers lack documentation type: feature request ___ Python tracker <http://bugs.python.org/issue7035> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7257] Improve documentation of list.sort and sorted()
New submission from Ole Laursen : On my Python 3.1, help() for sorted returns sort(...) L.sort(key=None, reverse=False) -- stable sort *IN PLACE* sorted(...) sorted(iterable, key=None, reverse=False) --> new sorted list Kindly suggest this be expanded. Here's some text: sort(...) Sorts the sequence with a fast stable sort. The sequence is modified in place. To remind you of this, the function always returns None. Example: a = [1, 3, 2] a.sort() # a is now [1, 2, 3] Use the "sorted()" built-in function if you need to preserve the original list. Set "reverse" to True to sort the elements in reverse order. A function for extracting a key for comparison from each object can be passed in as "key", e.g. a = [{'k': 'foo'}, {'k': 'bar'}] a.sort(key=lambda x: x['k']) # a is now [{'k': 'bar'}, {'k': 'foo'}] Note that "key" can be used to solve many sorting problems, e.g. key=str.lower can be used for case-insensitive sorting and key=lambda x: (x['a'], x['b']) can be used to sort by first 'a' then 'b'. The sort is stable which means that the relative order of elements that compare equal is not changed. sorted(...) Sorts the sequence with a fast stable sort and returns a new list with the result. Example: [same text as before] I'm not sure how this interacts with what's in the online help (http://docs.python.org/3.1/library/stdtypes.html search for "sort("), maybe the text could just be copied over. I think it's important to give copy-pasteable examples for something as important as this, and hint at how you solve common sorting problems. -- assignee: georg.brandl components: Documentation messages: 94863 nosy: georg.brandl, olau severity: normal status: open title: Improve documentation of list.sort and sorted() ___ Python tracker <http://bugs.python.org/issue7257> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7257] Improve documentation of list.sort and sorted()
Ole Laursen added the comment: If you think it's too long, here's a shorter version: Sorts sequence in place with a fast stable sort, returning None. key is a function for extracting a comparison key from each element, e.g. key=lambda x: x['name'] or key=str.lower. reverse=True reverses the result order. a = [1, 3, 2] a.sort() # a is now [1, 2, 3] Use the "sorted()" built-in function if you need to preserve the original list. Is this better? You could whack the last comment about sorted and/or the example, then it's about the same length as the other built-in docstrings (e.g. zip, reduce, getattr). -- nosy: -rhettinger ___ Python tracker <http://bugs.python.org/issue7257> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7257] Improve documentation of list.sort and sorted()
Ole Laursen added the comment: OK, thanks! :) Sorry about the unintended nosy list removal, my browser got me there. -- ___ Python tracker <http://bugs.python.org/issue7257> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7276] UnboundLocalError scoping problem with nested functions
Ole Laursen added the comment: OK, sorry, I was under the impression that the global binding was still available (I can't find anything to the contrary here http://docs.python.org/reference/simple_stmts.html#assignment-statements ) but it's obviously using a static definition of scope. The error message isn't super helpful, though. :) Would it make sense to add a "(non-local "tmp" is shadowed)"? I guess that's easy to detect? -- ___ Python tracker <http://bugs.python.org/issue7276> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7290] Update 'how do I set a global variable' faq entry
Ole Laursen added the comment: As the reporter of issue 7276, I think it's a clear explanation of this phenomonen. I think that maybe you should remove the "New Python programmers" in "New Python programmers are often surprised when they get this error in previously working code when they modify it by adding an assignment statement somewhere in the body of a function." so say something like "It can be a surprise to get this error in previously working code when it is modified by adding an assignment statement somewhere in a function body." -- nosy: +olau ___ Python tracker <http://bugs.python.org/issue7290> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com