semi-concatenated strings

Grant Griffin Grant_member at newsguy.com
Thu May 30 15:49:58 EDT 2002


Hi Gang,

I discovered today that strings can sometimes be concatenated without using a
"+":

   ActivePython 2.2.1 Build 222 (ActiveState Corp.) based on
   Python 2.2.1 (#34, Apr 15 2002, 09:51:39) [MSC 32 bit (Intel)] on win32
   Type "help", "copyright", "credits" or "license" for more information.
   >>> a = 'one' ' plus ' 'two'
   >>> a
   'one plus two'

I discovered this, of course, while making a mistake like this:

   >>> a = ['zero', 'one'
   ...       'two', 'three']
   >>> a
   ['zero', 'onetwo', 'three']

(Note the missing comma after 'one'.)

Is there some grand purpose here, or is this just a bug in the parser?

errors-should-never-pass-silent-ly y'rs,

=g2




More information about the Python-list mailing list