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/2010-June/101135.html below:

[Python-Dev] thoughts on the bytes/string discussion

[Python-Dev] thoughts on the bytes/string discussionNick Coghlan ncoghlan at gmail.com
Sun Jun 27 04:59:07 CEST 2010
On Sun, Jun 27, 2010 at 8:11 AM, Terry Reedy <tjreedy at udel.edu> wrote:
> I can imagine that inter-operation, when appropriate, might work better with
> addition of a couple of  missing __rxxx__ methods, such as the mentioned
> __rcontains__. Although adding such would affect the implementation of a
> core syntax feature, it would not affect syntax as such as seen by the user.

The problem with strings isn't really the binary operations like
__contains__ - adding __rcontains__ would be a fairly simple
extrapolation of the existing approaches.

Where it gets really messy for strings is the fact that whereas
invoking named methods directly on numbers is rare, invoking them on
strings is very common, and some of those methods (e.g. split(),
join(), __mod__()) allow or require an iterable rather than a single
object. This extends the range of use cases to be covered beyond those
with syntactic support to potentially include all string methods that
take arguments. Creating minimally surprising semantics for the
methods which accept iterables is also rather challenging.

It's an interesting idea, but I think it's overkill for the specific
problem of making it easier to perform more text-like manipulations in
a bytes-only domain.

Cheers,
NIck.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
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