Unexpected string behaviour: txt = 'this' ' works'
- From: christopher.saunter@xxxxxxxxxxxx (c d saunter)
- Date: Wed, 11 Feb 2009 11:06:31 +0000 (UTC)
I did a double take when debugging an error the other day. My
problem was missing out a comma when building a list of strings.
Much to my surprise the offending code still executed to cause
problems later on:
('this', 'works')txt = 'this', 'works'
print txt
# As expected
thisworkstxt = 'this' 'works'
print txt
# Eh?
I have never seen this behaviour before, but it works in Python 2.2.1
and 2.5.4 so I guess it's meant to be there. I assume it is a feature
of the compiler.
Any thoughts?
Regards
Chris
.
- Follow-Ups:
- Re: Unexpected string behaviour: txt = 'this' ' works'
- From: bearophileHUGS
- Re: Unexpected string behaviour: txt = 'this' ' works'
- From: Bruno Desthuilliers
- Re: Unexpected string behaviour: txt = 'this' ' works'
- Prev by Date: Re: generator object or 'send' method?
- Next by Date: Re: python is great
- Previous by thread: urllib2.Request:: http Request sending successfully, but Response contains in valid data.
- Next by thread: Re: Unexpected string behaviour: txt = 'this' ' works'
- Index(es):
Relevant Pages
|