[issue1240] str.split bug
Changes by Tim Gordon: -- title: str.split possible bug -> str.split bug __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1240> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1240] str.split possible bug
New submission from Tim Gordon: >From the docs for str.split: "If sep is not specified or is None... First, whitespace characters are stripped from both ends. Then, words are separated by arbitrary length strings of whitespace characters." However, ' a b c '.split(None, 1) returns ['a', 'b c '] indicating that the "stripped from both ends" isn't taking place, but that it's removing whitespace as it goes and never gets to the end as it stops parsing when it hits the first split. Note this is easily worked around by calling str.strip().split(None, 1), but it would be good not to have to. I've tested this on windows version 2.5, and 2.4.4 for Debian -- messages: 56237 nosy: QuantumTim severity: normal status: open title: str.split possible bug type: behavior versions: Python 2.4, Python 2.5 __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1240> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1240] str.split bug when using sep = None and maxsplit
Changes by Tim Gordon: -- title: str.split bug -> str.split bug when using sep = None and maxsplit __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1240> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1271] Raw string parsing fails with backslash as last character
New submission from Tim Gordon: If you have a raw string with a backslash as the last character, the parser thinks the following quote, actually used to mark the end of the string, is being quoted by the backslash. For example, r'\' should be the string with one backslash, but... >>> print r'\' SyntaxError: EOL while scanning single-quoted string There seems to have been a fix added to python 3.0 (see issue 1720390), but it doesn't look like it's been backtracked into any earlier version. -- components: Interpreter Core messages: 56370 nosy: QuantumTim severity: normal status: open title: Raw string parsing fails with backslash as last character versions: Python 2.4, Python 2.5 __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1271> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1271] Raw string parsing fails with backslash as last character
Tim Gordon added the comment: So basically raw strings are useless if you need to end a string with a backslash, as there is no way to quote the backslash to make it not do this... This surely can't be too hard to "fix" if one considers it a problem (which I do), and just because even the docs say it is the correct behaviour, doesn't mean it should be. Perhaps this has been debated before (and if so, where?), but it does seem rather odd behaviour. __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1271> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4031] 08 value popups an stdin error, no date handle allowed
Tim Gordon <[EMAIL PROTECTED]> added the comment: By prefixing a number with 0, you're actually using octal rather than decimal (i.e., only digits 0 to 7 are valid). For example, try: >>> print 030 24 >>> print 077 63 patricio wrote: > New submission from patricio <[EMAIL PROTECTED]>: > > a = 08 > print a > File"",line 1 > a = 08 > < > syntax error:invalid token > > (if I use 07, the 0 is supressed but it compiles & display the 7) > > -- > messages: 74258 > nosy: pgimelli > severity: normal > status: open > title: 08 value popups an stdin error, no date handle allowed > type: compile error > versions: Python 2.5 > > ___ > Python tracker <[EMAIL PROTECTED]> > <http://bugs.python.org/issue4031> > ___ > ___ > New-bugs-announce mailing list > [EMAIL PROTECTED] > http://mail.python.org/mailman/listinfo/new-bugs-announce > > -- nosy: +QuantumTim ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue4031> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4031] 08 value popups an stdin error, no date handle allowed
Tim Gordon <[EMAIL PROTECTED]> added the comment: Whoops, I thought the tracker automatically removed quoted text! :z ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue4031> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2294] Bug in Pickle protocol involving __setstate__
Tim Gordon <[EMAIL PROTECTED]> added the comment: You've missed off the two underscores after the name __setstate__ :p -- nosy: +QuantumTim __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2294> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4115] split() method
Tim Gordon <[EMAIL PROTECTED]> added the comment: This is the intended behaviour. See http://www.python.org/doc/2.5.2/lib/string-methods.html for details. -- nosy: +QuantumTim ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue4115> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4633] file.tell() gives wrong result
Tim Gordon <[EMAIL PROTECTED]> added the comment: See the documentation for file.next (http://docs.python.org/library/stdtypes.html#file.next). As you can see, file.next uses a buffer which will mess with the result of other methods, such as file.tell. -- nosy: +QuantumTim ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue4633> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4633] file.tell() gives wrong result
Tim Gordon <[EMAIL PROTECTED]> added the comment: Try using the readline method instead of next. I don't think that applies the same buffering. ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue4633> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5242] eval() function in List Comprehension doesn't work
Tim Gordon added the comment: If you know what variable you are going to be eval-ing, or at least, have a list of those that might be eval-ed, you can get around this issue by making sure they are explicitly referenced in the inner scope (i.e., in the list comprehension). For example, even though list comprehensions work in 2.x, generator expressions don't, but this hack does (on 2.4 at least): def f(): canBusType = 'CANdiag' return (eval('canBusType') for i in range(3) if True or canBusType) By putting a semantically vacuous reference to canBusType (and any other variables you want) you make sure they are usable from within the eval as well. -- nosy: +QuantumTim ___ Python tracker <http://bugs.python.org/issue5242> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6410] Dictionaries should support __add__
Tim Gordon added the comment: __add__ is non-commutative for lists, tuples, strings etc. - perhaps non-commutative wasn't quite what you were looking for :p. -- nosy: +QuantumTim status: pending -> open ___ Python tracker <http://bugs.python.org/issue6410> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5374] optparse special usage tokens conflict with formatting characters
Tim Gordon added the comment: Try escaping the '%prog' in your usage string (i.e. use '%%prog' instead) so you don't get the error when you substitute values in. -- nosy: +QuantumTim ___ Python tracker <http://bugs.python.org/issue5374> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com