Friday, May 7, 2010

Python and Quotes - how?

More from Python interpreter:
>>> '"Isn\'t," she said.'
'"Isn\'t," she said.'
Does it mean there is no way to have both single and double quotes in a Python literal???

Update: it seems to be an interpreter bug:
result = '"Isn\'t," she said.'
print result
would produce the expected
"Isn't," she said.
after all :)

python and rounding

From my Python interpreter (version 2.6.5) where I was playing with calculator:
>>> price + 0.2342341
22.234234099999998
>>> round(_,3)
22.234000000000002
Why do I always get the stuff the wrong way?