Forcing quote characters in repr(STRING), how?

Marcin 'Qrczak' Kowalczyk qrczak at knm.org.pl
Thu May 3 08:30:16 EDT 2001


Wed, 2 May 2001 18:04:24 -0400, Tim Peters <tim.one at home.com> pisze:

> 	/* figure out which quote to use; single is preferred */
> 	quote = '\'';
> 	if (strchr(op->ob_sval, '\'') && !strchr(op->ob_sval, '"'))
> 		quote = '"';

This is inconsistent because it stops searching at '\0':

>>> "asdf'gh"
"asdf'gh"
>>> "as\0df'gh"
'as\x00df\'gh'

-- 
 __("<  Marcin Kowalczyk * qrczak at knm.org.pl http://qrczak.ids.net.pl/
 \__/
  ^^                      SYGNATURA ZASTĘPCZA
QRCZAK



More information about the Python-list mailing list