On 22 August 2016 at 19:47, Stephen J. Turnbull
wrote:
> Nick Coghlan writes:
>
> > However, the real problem with this proposal (and the reason why the
> > switch from 8-bit str to "bytes are effectively a tuple of ints" in
> > Python 3 was such a pain),
Nick Coghlan writes:
> However, the real problem with this proposal (and the reason why the
> switch from 8-bit str to "bytes are effectively a tuple of ints" in
> Python 3 was such a pain), is that there are a lot of bytes and text
> processing operations that *really do* operate code point
On Sun, Aug 21, 2016 at 6:08 PM, wrote:
>
> from __future__ import unicode_literals outright changes the type of object
> string literals make (in python 2). If you were to create a non-iterable,
> non-sequence text type (a horrible idea, IMO) the same thing can be
On 21.08.2016 04:52, Steven D'Aprano wrote:
Saying that these so-called "fixes" (we haven't established yet that
Python's string behaviour is a bug that need fixing) will be easier and
more obvious than the change to Unicode is not that bold a claim.
Agreed. Especially those "we need to
From: Python-ideas
[mailto:python-ideas-bounces+tritium-list=sdamon@python.org] On Behalf Of
?
Sent: Saturday, August 20, 2016 5:56 PM
To: python-ideas <python-ideas@python.org>
Subject: Re: [Python-ideas] discontinue iterable strings
On Sun, Aug 21, 2016 at 12:28 AM Alexander
On Sun, Aug 21, 2016 at 2:46 AM eryk sun wrote:
> On Sun, Aug 21, 2016 at 6:34 AM, Michael Selik
> wrote:
> > The detection of not hashable via __hash__ set to None was necessary, but
> > not desirable. Better to have never defined the
On Sun, Aug 21, 2016 at 6:34 AM, Michael Selik wrote:
> The detection of not hashable via __hash__ set to None was necessary, but
> not desirable. Better to have never defined the method/attribute in the
> first place. Since __iter__ isn't present on ``object``, we're
On Sun, Aug 21, 2016 at 1:27 AM Chris Angelico wrote:
> Hmm. It would somehow need to be recognized as "not iterable". I'm not
> sure how this detection is done; is it based on the presence/absence
> of __iter__, or is it by calling that method and seeing what comes
> back? If
On 21 August 2016 at 16:02, eryk sun wrote:
> On Sun, Aug 21, 2016 at 5:27 AM, Chris Angelico wrote:
>> Hmm. It would somehow need to be recognized as "not iterable". I'm not
>> sure how this detection is done; is it based on the presence/absence
>> of
On Sun, Aug 21, 2016 at 5:27 AM, Chris Angelico wrote:
> Hmm. It would somehow need to be recognized as "not iterable". I'm not
> sure how this detection is done; is it based on the presence/absence
> of __iter__, or is it by calling that method and seeing what comes
> back? If
On 21 August 2016 at 15:22, Nick Coghlan wrote:
> There may also be a case to be made for introducing an AtomicStr type
> into Python's data model that works like a normal string, but
> *doesn't* support indexing, slicing, or iteration, and is instead an
> opaque blob of data
On Sun, Aug 21, 2016 at 12:52 PM, Steven D'Aprano wrote:
>> > The fixes overall will be a lot easier and obvious than introduction of
>> > unicode as default string type in Python 3.0.
>>
>> That's a bold claim. Have you considered what's at stake if that's not true?
>
>
On Sun, Aug 21, 2016 at 12:28 AM Alexander Heger wrote:
> Did I leave anything out?
>> How would you weigh the benefits against the problems?
>> How would you manage the upgrade path for code that's been broken?
>>
>
> FIrst one needs to add the extension string attributes like
>
>
> So you can't lose iteration without also losing subscripting.
>>>
>>
>> Python here does a lot of things implicitly. I always felt the
>> (explicit) index operator in strings in many other languages sort of is
>> syntactic sugar, in python it was taken to do literally the same things as
>> on
On Sat, Aug 20, 2016 at 4:57 PM Alexander Heger wrote:
> So you can't lose iteration without also losing subscripting.
>>
>
> Python here does a lot of things implicitly. I always felt the (explicit)
> index operator in strings in many other languages sort of is syntactic
>
On Sat, Aug 20, 2016 at 3:48 AM Chris Angelico wrote:
> On Sat, Aug 20, 2016 at 4:28 PM, Alexander Heger wrote:
> > Yes, I am aware it will cause a lot of backward incompatibilities...
>
> Tell me, would you retain the ability to subscript a string to get its
>
On Sat, Aug 20, 2016 at 4:28 PM, Alexander Heger wrote:
> Yes, I am aware it will cause a lot of backward incompatibilities...
Tell me, would you retain the ability to subscript a string to get its
characters?
>>> "asdf"[0]
'a'
If not, you break a ton of code. If you do, they
On Aug 20, 2016 2:27 AM, "Alexander Heger" wrote:
> The point is it does not try to disassemble it into elements as it would
do with other iterables
>
> >>> np.array([1,2,3])
> array([1, 2, 3])
> >>> np.array([1,2,3]).shape
> (3,)
It isn't so much that strings are special, it's
>
> > That says, "This is a 0-length array of 3-char Unicode strings." Numpy
> > doesn't recognize the string as a specification of an array. Try
> > `np.array(4.)` and you'll get (IIRC) `array(4., dtype='float')`, which
> > has
> > shape `()`. Numpy probably won't let you index either one. What
This would introduce a major inconsistency. To do this, you would need to
also strip string’s of their status as sequences (in collections.abc,
Sequence is a subclass of Iterable). Thus, making string’s no longer
iterable would also mean you could no longer take the length or slice of a
string.
On 20 August 2016 at 15:47, Franklin? Lee
wrote:
On Aug 19, 2016 11:14 PM, "Alexander Heger" wrote:
>
> standard python should discontinue to see strings as iterables of
characters - length-1 strings. I see this as one of the biggest design
flaws
On Sat, Aug 20, 2016, at 01:47, Franklin? Lee wrote:
> That says, "This is a 0-length array of 3-char Unicode strings." Numpy
> doesn't recognize the string as a specification of an array. Try
> `np.array(4.)` and you'll get (IIRC) `array(4., dtype='float')`, which
> has
> shape `()`. Numpy
On Fri, Aug 19, 2016, at 23:13, Alexander Heger wrote:
> Numpy was of course design a lot later, with more experience in practical
> use (in mind).
The meaning of np.array('abc') is a bit baffling to someone with no
experience in numpy. It doesn't seem to be a one-dimensional array
containing
23 matches
Mail list logo