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/2008-June/079979.html below:

[Python-Dev] Mini-Pep: An Empty String ABC

[Python-Dev] Mini-Pep: An Empty String ABCRaymond Hettinger python at rcn.com
Mon Jun 2 22:54:08 CEST 2008
From: "Guido van Rossum" <guido at python.org>
> All this makes me lean towards a rejection of this proposal -- it
> seems worse than no proposal at all. It could perhaps be rescued by
> adding some small set of defined operations.

By subclassing Sequence, we get index() and count() mixins for free.

We can also add other mixin freebies like __hash__(), __eq__(), __ne__(), endswith(), startswith(), find(), rfind(), and rindex().

It's tempting to add center, lust, rjust, and zfill, but those require some sort of constructor that accepts an iterable argument.

As important as what is included are the methods intentionally left out.   I'm trying to avoid insisting on abstractmethods like 
encode(), split(), join(), and other methods that place an undue burden on a class being registered as a String.


Raymond





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