A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2005-September/055947.html below:

[Python-Dev] String views

[Python-Dev] String views [Python-Dev] String viewsGreg Ewing greg.ewing at canterbury.ac.nz
Thu Sep 1 05:56:11 CEST 2005
skip at pobox.com wrote:
> If I then wanted to see what scheme's value
> compared to, the string's comparison method would have to recognize that it
> wasn't truly NUL-terminated, copy it, call strncmp() or whatever underlying
> routine is used for string comparisons.

Python string comparisons can't be using anything that
relies on nul-termination, because Python strings can
contain embedded nuls. Possibly it uses memcmp(), but
that takes a length.

You have a point when it comes to passing strings to
other C routines, though. For those that don't have a
variant which takes a maximum length, the substring type
might have to keep a cached nul-terminated copy created
on demand. Then the copying overhead would only be
incurred if you did happen to pass a substring to such
a routine.

Greg
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4