I realize this is probably something that would be hard to change for
compatibility reasons. Maybe someone can think of a way around that though?
It seems to me that `not NotImplemented` should result in `NotImplemented` and
attempting to convert it to `bool` should raise a `TypeError` exception
Christopher, I'm not sure how much of the following you already know, so
excuse me in advance if I'm covering old ground for you. But hopefully
it will be helpful for someone!
On Tue, Mar 10, 2020 at 01:18:22PM -0700, Christopher Barker wrote:
> Getting a bit OT, but I *think* this is the story
On Wed, Mar 11, 2020 at 07:28:06AM +1100, Chris Angelico wrote:
> That's exactly what "ASCII compatible" means. Since ASCII is a
> seven-bit encoding, an encoding is ASCII-compatible if (a) every ASCII
> character is represented by the corresponding byte value, and (b)
> every seven-bit value repr
On Wed, Mar 11, 2020 at 9:05 PM Steven D'Aprano wrote:
> In practice, modern Unix shells and GUIs use UTF-8. UTF-8 has two nice
> properties:
>
> * Every ASCII character encodes to a single byte, so text which
> only contains ASCII values encodes to precisely the same set
> of bytes under UTF-
NotImplemented is not supposed to be used in any operation. It's just
a special value used in coercion since raising exceptions would be
too costly.
In your example you would need to check for this special value using
the "is" comparison.
See https://www.python.org/dev/peps/pep-0208/ and
https://
On Wed, Mar 11, 2020 at 9:28 PM Steven D'Aprano wrote:
>
> On Wed, Mar 11, 2020 at 07:28:06AM +1100, Chris Angelico wrote:
>
> > That's exactly what "ASCII compatible" means. Since ASCII is a
> > seven-bit encoding, an encoding is ASCII-compatible if (a) every ASCII
> > character is represented by
Steve Jorgensen wrote:
> I realize this is probably something that would be hard to change for
> compatibility
> reasons. Maybe someone can think of a way around that though?
> It seems to me that not NotImplemented should result in
> NotImplemented and attempting to convert it to bool should rais
On Wed, Mar 11, 2020 at 09:42:15AM -, Steve Jorgensen wrote:
> I realize this is probably something that would be hard to change for
> compatibility reasons. Maybe someone can think of a way around that
> though?
>
> It seems to me that `not NotImplemented` should result in
> `NotImplement
Steven D'Aprano wrote:
> On Wed, Mar 11, 2020 at 09:42:15AM -, Steve Jorgensen wrote:
> > I realize this is probably something that would be
> > hard to change for
> > compatibility reasons. Maybe someone can think of a way around that
> > though?
> > It seems to me that not NotImplemented sh
On 10/03/2020 20:18, Christopher Barker wrote:
...much about file naming in theory and practice under Unix, concluding
with:
But bytes has a pretty full set of "string like" methods now, so I suppose
it makes sense to add a couple new ones that are related to ones that are
already there.
I
Looks like NotImplemented is widely misunderstood. It should *ONLY* be
returned from binary operator overloads, like __add__.
On Wed, Mar 11, 2020 at 03:49 wrote:
> Steven D'Aprano wrote:
> > On Wed, Mar 11, 2020 at 09:42:15AM -, Steve Jorgensen wrote:
> > > I realize this is probably someth
Guido van Rossum wrote:
> Looks like NotImplemented is widely misunderstood. It should ONLY be
> returned from binary operator overloads, like __add__.
> On Wed, Mar 11, 2020 at 03:49 jdve...@gmail.com
> wrote:
> > Steven D'Aprano wrote:
> > On Wed, Mar 11, 2020 at 09:42:15AM -, Steve
> > Jorge
11.03.20 12:39, Steven D'Aprano пише:
https://bugs.python.org/issue35712
I am disappointed because, to me, it is a fundamental part of Python's
object model that *everything* can be interpreted as a truthy/falsey
object (in the absence of bugs).
NotImplemented is special. It is more special th
On Mar 11, 2020, at 03:07, Steven D'Aprano wrote:
>
> But bytes are useful for more than just file names!
The paradigm example of this is HTTP. It’s mostly people working on HTTP
clients, servers, middleware, and apps who pushed for the bytes methods in
Python 3.x. IIRC, the PEP for bytes.__mo
On Mar 11, 2020, at 02:42, Steve Jorgensen wrote:
>
> Take the following example:
>
> ```
>def __lt__(self, other):
>return not self.__ge__(other):
>
>def __le__(self, other):
>return not self.__gt__(other):
>
>def __ge__(self, other):
>
> ```
Usually you c
Rhodri James writes:
> We've headed off down the rabbit-hole of filenames for
> justification here, but surely pathlib is the correct tool if you
> are going to be chopping up filenames and path names?
This isn't obvious to me. The majority of people (among those for
whom my respect is "very
On 03/11/2020 11:16 AM, Andrew Barnert via Python-ideas wrote:
On Mar 11, 2020, at 02:42, Steve Jorgensen wrote:
Take the following example:
```
def __lt__(self, other):
return not self.__ge__(other):
def __le__(self, other):
return not self.__gt__(other):
def __
On 11/03/2020 18:45, Stephen J. Turnbull wrote:
Rhodri James writes:
> We've headed off down the rabbit-hole of filenames for
> justification here, but surely pathlib is the correct tool if you
> are going to be chopping up filenames and path names?
This isn't obvious to me. The majority
On Wed, Mar 11, 2020 at 07:06:20PM +0200, Serhiy Storchaka wrote:
> 11.03.20 12:39, Steven D'Aprano пише:
> >https://bugs.python.org/issue35712
> >
> >I am disappointed because, to me, it is a fundamental part of Python's
> >object model that *everything* can be interpreted as a truthy/falsey
> >ob
> On 11 Mar 2020, at 19:03, Rhodri James wrote:
>
> On 11/03/2020 18:45, Stephen J. Turnbull wrote:
>> Rhodri James writes:
>> > We've headed off down the rabbit-hole of filenames for
>> > justification here, but surely pathlib is the correct tool if you
>> > are going to be chopping up fil
On Wed, Mar 11, 2020 at 6:59 AM Rhodri James wrote:
> I disagree. We've headed off down the rabbit-hole of filenames for
> justification here, but surely pathlib is the correct tool if you are
> going to be chopping up filenames and path names?
Does pathlib work correctly for paths in unknown
On Wed, Mar 11, 2020 at 10:09 AM Serhiy Storchaka wrote:
> There is a precedence (although not in the stdlib): NumPy array with
> dtype=bool.
>
> >>> import numpy
> >>> bool(numpy.array([False, False]))
> Traceback (most recent call last):
> File "", line 1, in
> ValueError: The trut
12.03.20 08:08, Ben Rudiak-Gould пише:
There are some cases in the standard library, e.g.
>>> import dbm.dumb
>>> db = dbm.dumb.open('foo')
>>> db.close()
>>> not db
Traceback (most recent call last):
File "", line 1, in
OSError: DBM object has already been closed
mmap.m
23 matches
Mail list logo