regex into str
Peter Kleiweg
in.aqua.scribis at nl.invalid
Sun Aug 29 06:58:57 EDT 2004
Jeremy Bowers schreef:
> 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.
I mean in the sense it does, and in that sense it does.
>
> 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.
That is not relevant. What matters is that a += 'b' does what it
is supposed to do.
> > Is there a way to tell Python that '' should be something else
> > than str?
>
> No.
Bummer.
--
Peter Kleiweg L:NL,af,da,de,en,ia,nds,no,sv,(fr,it) S:NL,de,en,(da,ia)
info: http://www.let.rug.nl/~kleiweg/ls.html
More information about the Python-list
mailing list