[Zope] Python nasty :S

2000-08-01 Thread Chris Withers

Flame me if you want, but this one really got me bad so I thought I'd
make others aware...

cheers,

Chris

ChrisW's post to the Python Bug List:
 I have something equivalent to this in my code:
 
 mylist = ['x','y'
   'z']
 
 (the real code has much longer contents, hence the line break ;-)
 
 I think this should throw a parse error 'cos there's a missing comma.
 
 What actually happens is it ends up as:
 
 mylist = ['x','yz']
 
 which is _really_ non-intuitive. I spent a good few hours trying to find the source
 of an exception in the Squishdot product for Zope until I noticed this.
 
 I note that:
 mystring = 'x''y'
 is also legal, which I suspect is the roundabout source of this problem.
 
 Sure that should raise an error and only the following should give the result that 
that does:
 mystring = 'x'+'y'
 
 cheers,
 
 Chris

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] Python nasty :S

2000-08-01 Thread Chris Withers

We have a reply... oh well :S

chris

Tim Peters wrote:
 
 Sorry, but this is a documented feature:  just as in C, adjacent string
 literals are concatenated at compile-time.  You bumped up against the Dark
 Side of that.  The Bright Side is, e.g.,
 
 logfile.write("And here I need to write something "
   "to a log file that spills over a line "
   "of source code but I want it want to "
   "appear in the log as one line."
   "\n")
 
 It can't be made an error, as lots of code relies on it now.

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )