Re: Python doesn't recognize quote types
Dennis Lee Bieber [EMAIL PROTECTED] wrote: The sloppy use of single quote for the apostrophe is unfortunate G True, but that problem is outside of the Python community's control. Given that people do often refer to single quote when they mean apostrophe the error message should be written so as to minimise confusion. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python doesn't recognize quote types
On May 12, 8:31 am, Duncan Booth [EMAIL PROTECTED] wrote: Dennis Lee Bieber [EMAIL PROTECTED] wrote: The sloppy use of single quote for the apostrophe is unfortunate G True, but that problem is outside of the Python community's control. Given that people do often refer to single quote when they mean apostrophe the error message should be written so as to minimise confusion. FYI, there are actually 2 types of quote character, single and double, each with 2 forms, left and right. In Unicode the single-quote characters are U+2018 (‘) and U+2019 (’) and the double-quote characters are U+201C (“) and U+201D (”). The right-hand single-quote is also the apostrophe. In order to reduce the size of the character set needed, computer manufacturers introduced 'sexless' quote characters, the single-quote/ aphostrophe U+0027 (') and double-quote U+0022 (). -- http://mail.python.org/mailman/listinfo/python-list
Re: Python doesn't recognize quote types
[EMAIL PROTECTED] wrote: There's a thing that bugs me in Python. Look at this... print Testing\ SyntaxError: EOL while scanning single-quoted string Please focus on the part of the error message that states while scanning single-quoted string. How can Python claim it scanned a single-quoted string when I fed it with a double-quoted string? Is quote type (single quote and double quote) recognition not implemented in Python? Of course it is, but that isn't what is meant here. Python supports single-quoted strings which are delimited by either a single quote or a double quote mark. It also supports triple-quoted strings which are delimited either by three single quotes or three double quotes. The overloaded meaning of 'single' is perhaps unfortunate. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python doesn't recognize quote types
* [EMAIL PROTECTED] [EMAIL PROTECTED] [2008-05-10 13:56:39 -0700]: There's a thing that bugs me in Python. Look at this... print Testing\ SyntaxError: EOL while scanning single-quoted string Please focus on the part of the error message that states while scanning single-quoted string. How can Python claim it scanned a single-quoted string when I fed it with a double-quoted string? Is quote type (single quote and double quote) recognition not implemented in Python? The single-quoted string (e.g. 'foo' or bar) is so named by opposition to triple-quoted (e.g. '''foo''' or bar) strings. Regards, -- Nicolas Dandrimont signature.asc Description: Digital signature -- http://mail.python.org/mailman/listinfo/python-list
Re: Python doesn't recognize quote types
On May 11, 6:56 am, [EMAIL PROTECTED] wrote: There's a thing that bugs me in Python. Look at this... print Testing\ SyntaxError: EOL while scanning single-quoted string Please focus on the part of the error message that states while scanning single-quoted string. How can Python claim it scanned a single-quoted string when I fed it with a double-quoted string? Is quote type (single quote and double quote) recognition not implemented in Python? Read this: http://docs.python.org/ref/strings.html Try each of these: print 'Testing print 'Testing\' print 'Testing\'Testing print 'Testing' print 'Testing\'' print 'Testing\'Testing' There's a wrinkle that's common to both your questions: \ causes the not to be regarded as (part of) the end marker but to be included as a data character. Similarly with '. Examples: print She said \Hello!\ She said Hello! print 'His surname is O\'Brien' His surname is O'Brien In the error message, quoted is the past tense of the verb to quote, meaning to wrap a string of characters with a leading string and a trailing string to mark the contained string as a lexical item, typically a string constant. The message is intended to convey that the leading marker has been seen, but an EOL (end of line) was reached without seeing the trailing marker. A better error message might be something like String constant not terminated at end of line. Unfortunately the above-mentioned documentation uses le-quote as a noun to describe characters -- IMHO this is colloquial and confusing; it should call ' an apostrophe, not a single-quote, and all a quote, not a double-quote. The confusion is compounded by referring to '''abc''' and xyz as triple-quoted strings ... so one might expect 'abc' and xyz to be called single-quoted strings, and this sense is what is being used in the error message. HTH, John -- http://mail.python.org/mailman/listinfo/python-list