regex into str
Jeremy Bowers
jerf at jerf.org
Sun Aug 29 01:54:55 EDT 2004
On Sun, 29 Aug 2004 04:08:57 +0200, Peter Kleiweg wrote:
> This works:
>
> a += 'x'
In the sense you mean, no it doesn't.
Python 2.3.4 (#1, Jun 8 2004, 17:41:43)
[GCC 3.3.3 20040217 (Gentoo Linux 3.3.3, propolice-3.3-7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> a = 'a'
>>> a
'a'
>>> id(a)
1074037376
>>> a += 'b'
>>> a
'ab'
>>> id(a)
1074272448
Note the two different id numbers. 'a' and 'ab' are not the same string.
> Is there a way to tell Python that '' should be something else
> than str?
No.
More information about the Python-list
mailing list