> So, apart from compatibility purposes, what is the
> point currently of *not* directly subclassing str?
To provide your own storage format, such as a views into existing data.
Whether or not this is actually practical is a different question;
plenty C code tends to assume it can use the interna
Given the lack of responses to my questions, let's reject this.
--
--Guido van Rossum (home page: http://www.python.org/~guido/)
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://ma
From: "Antoine Pitrou" <[EMAIL PROTECTED]>
It seems to me that Sequence.index()/count() and String.index()/count()
shouldn't have the same semantics.
In the former case they search for items in the Sequence, in the latter case
they search for substrings of the String.
And the same applies to _
Raymond Hettinger rcn.com> writes:
>
> By subclassing Sequence, we get index() and count() mixins for free.
>
It seems to me that Sequence.index()/count() and String.index()/count()
shouldn't have the same semantics.
In the former case they search for items in the Sequence, in the latter case
Please try to find the largest set of methods that you're comfortable
with. __add__ comes to mind.
Note that if you add __hash__, this rules out bytearray -- is that
your intention? __hash__ is intentionally not part of the "read-only"
ABCs because read-only doesn't mean immutable.
Also, (again)
From: "Guido van Rossum" <[EMAIL PROTECTED]>
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.
W
Guido van Rossum wrote:
This PEP is incomplete without specifying exactly which built-in and
stdlib types should be registered as String instances.
I'm also confused -- the motivation seems mostly "so that you can skip
iterating over it when flattening a nested sequence" but earlier you
rejected
This PEP is incomplete without specifying exactly which built-in and
stdlib types should be registered as String instances.
I'm also confused -- the motivation seems mostly "so that you can skip
iterating over it when flattening a nested sequence" but earlier you
rejected my "Atomic" proposal, say
Raymond Hettinger rcn.com> writes:
> Also, starting with Py3.0, strings are
> essentially abstract sequences of code points, meaning that an encode() method
> is essential to being able to usefully transform them back into concrete data.
Well, that depends:
- is a String the specification of a ge
Mini-Pep: An Empty String ABC
Target: Py2.6 and Py3.0
Author: Raymond Hettinger
Proposal
Add a new collections ABC specified as:
class String(Sequence):
pass
Motivation
--
Having an ABC for strings allows string look-alike classes to declare
themselves as sequence
10 matches
Mail list logo