[issue4164] String double quoted fatal problem

2008-10-21 Thread Felipe

New submission from Felipe [EMAIL PROTECTED]:

Hi

I have a problem with python 2.6, when i try to process strings with
triple-quoted string literal i get an error:

a='a''a' #1 double quoted Ok

a='aa' # 2 Ok

a= 'a''a' # 3 doble quoted -- SyntaxError: EOF while scanning
triple-quoted string literal

a= 'aa' # 4 ok

a='a''a' # 5 same error impair doble quoted

a='aa' # 6 Ok...

a... #7 error..

--
components: Library (Lib)
messages: 75038
nosy: cliffdover88
severity: normal
status: open
title: String double quoted fatal problem
type: compile error
versions: Python 2.6

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4164
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4164] String double quoted fatal problem

2008-10-21 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc [EMAIL PROTECTED] added the comment:

All your samples explain easily if you consider that two adjacent string 
literals are joined together. (You seem to consider that double quote 
is a way to insert a quote character. It's not; Python is not Pascal or 
SQL)

Your first two examples become:
a='a''a'   two adjacent strings == 'aa'
a='aa' three adjacent strings ('a' + '' + 'a') == 'aa'

The third is an error:
a='a''a' one string ('a') followed by the beginning of a triple 
quoted string (''') which content starts with the characters (''a') but 
does not have a matching (''') to finish the string, hence the Syntax 
error.

... and so on. Please have a look at 
http://docs.python.org/reference/lexical_analysis.html#string-literals

--
nosy: +amaury.forgeotdarc
resolution:  - invalid
status: open - closed

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4164
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com