Re: [Python-Dev] == on object tests identity in 3.x

2014-07-08 Thread Stephen J. Turnbull
Rob Cliffe writes: Why? What value (pun intended) is there in adding an explicit statement of value to every single class? It troubles me a bit that value seems to be a fuzzy concept - it has an obvious meaning for some types (int, float, list etc.) but for callable objects you

Re: [Python-Dev] == on object tests identity in 3.x

2014-07-08 Thread Chris Angelico
On Tue, Jul 8, 2014 at 5:01 PM, Stephen J. Turnbull step...@xemacs.org wrote: I agree with Steven d'A that this rule is not part of the language definition and shouldn't be, but it's the rule of thumb I find hardest to imagine *ever* wanting to break in my own code (although I sort of

Re: [Python-Dev] buildbot.python.org down again?

2014-07-08 Thread Donald Stufft
On Jul 8, 2014, at 12:58 AM, Nick Coghlan ncogh...@gmail.com wrote: On 7 Jul 2014 10:47, Guido van Rossum gu...@python.org wrote: It would still be nice to know who the appropriate persons are. Too much of our infrastructure seems to be maintained by house elves or the ITA. I

Re: [Python-Dev] == on object tests identity in 3.x

2014-07-08 Thread Stephen J. Turnbull
Chris Angelico writes: The reason NaN isn't equal to itself is because there are X bit patterns representing NaN, but an infinite number of possible non-numbers that could result from a calculation. I understand that. But you're missing at least two alternatives that involve raising on

Re: [Python-Dev] buildbot.python.org down again?

2014-07-08 Thread Guido van Rossum
May the true owner of buildbot.python.org stand up! (But I do think there may well not be anyone who feels they own it. And that's a problem for its long term viability.) Generally speaking, as an organization we should set up a process for managing ownership of *all* infrastructure in a uniform

Re: [Python-Dev] Updates to PEP 471, the os.scandir() proposal

2014-07-08 Thread Victor Stinner
Hi, 2014-07-08 15:52 GMT+02:00 Ben Hoyt benh...@gmail.com: After some very good python-dev feedback on my first version of PEP 471, I've updated the PEP to clarify a few things and added various Rejected ideas subsections. Here's a link to the new version (I've also copied the full text

Re: [Python-Dev] == on object tests identity in 3.x

2014-07-08 Thread Anders J. Munch
Chris Angelico wrote: This is off-topic for this thread, but still... The trouble is that your arguably just as wrong is an indistinguishable case. If you don't want two different calculations' NaNs to *ever* compare equal, the only solution is to have all NaNs compare unequal For two NaNs

Re: [Python-Dev] Updates to PEP 471, the os.scandir() proposal

2014-07-08 Thread Janzert
On 7/8/2014 9:52 AM, Ben Hoyt wrote: DirEntry fields being static attribute-only objects - In `this July 2014 python-dev message https://mail.python.org/pipermail/python-dev/2014-July/135303.html`_, Paul Moore suggested a solution that was a

Re: [Python-Dev] == on object tests identity in 3.x

2014-07-08 Thread Steven D'Aprano
On Tue, Jul 08, 2014 at 04:53:50PM +0900, Stephen J. Turnbull wrote: Chris Angelico writes: The reason NaN isn't equal to itself is because there are X bit patterns representing NaN, but an infinite number of possible non-numbers that could result from a calculation. I understand

Re: [Python-Dev] == on object tests identity in 3.x

2014-07-08 Thread Steven D'Aprano
On Tue, Jul 08, 2014 at 04:58:33PM +0200, Anders J. Munch wrote: For two NaNs computed differently to compare equal is no worse than 2+2 comparing equal to 1+3. You're comparing values, not their history. a = -23 b = -42 if log(a) == log(b): print a == b -- Steven

Re: [Python-Dev] == on object tests identity in 3.x

2014-07-08 Thread Chris Angelico
On Wed, Jul 9, 2014 at 3:00 AM, Steven D'Aprano st...@pearwood.info wrote: On Tue, Jul 08, 2014 at 04:58:33PM +0200, Anders J. Munch wrote: For two NaNs computed differently to compare equal is no worse than 2+2 comparing equal to 1+3. You're comparing values, not their history. a = -23 b

Re: [Python-Dev] == on object tests identity in 3.x

2014-07-08 Thread MRAB
On 2014-07-08 17:57, Steven D'Aprano wrote: [snip] In particular, reflexivity for NANs was dropped for a number of reasons, some stronger than others: - One of the weaker reasons for NAN non-reflexivity is that it preserved the identity x == y = x - y == 0. Although that is the cornerstone

Re: [Python-Dev] Updates to PEP 471, the os.scandir() proposal

2014-07-08 Thread Ben Hoyt
I remember a pending question on python-dev: - Martin von Loewis asked if the scandir generator would have send() and close() methods as any Python generator. I didn't see a reply on the mailing (nor in the PEP). Good call. Looks like you're referring to this message:

Re: [Python-Dev] Updates to PEP 471, the os.scandir() proposal

2014-07-08 Thread Ben Hoyt
Only exposing what the OS provides for free will make the API too difficult to use in the common case. But is there a nice way to expand the API that will allow the user who is trying to avoid extra expense know what information is already available? Even if the initial version doesn't have

Re: [Python-Dev] Updates to PEP 471, the os.scandir() proposal

2014-07-08 Thread Ben Hoyt
I think you're misunderstanding is_dir() and is_file(), as these don't actually call os.stat(). All DirEntry methods either call nothing or os.lstat() to get the stat info on the entry itself (not the destination of the symlink). Oh. Extract of your PEP: is_dir(): like os.path.isdir(), but

Re: [Python-Dev] Updates to PEP 471, the os.scandir() proposal

2014-07-08 Thread Ethan Furman
On 07/08/2014 12:34 PM, Ben Hoyt wrote: Better to just have the attributes be None if they were not fetched. None is better than hasattr anyway, at least in the respect of not having to catch exceptions to function properly. The thing is, is_dir() and lstat() are not attributes (for a good

Re: [Python-Dev] Updates to PEP 471, the os.scandir() proposal

2014-07-08 Thread Ben Hoyt
I did better than that -- I read the whole thing! ;) Thanks. :-) -1 on the PEP's implementation. Just like an attribute does not imply a system call, having a method named 'is_dir' /does/ imply a system call, and not having one can be just as misleading. Why does a method imply a system

Re: [Python-Dev] == on object tests identity in 3.x

2014-07-08 Thread Steven D'Aprano
On Tue, Jul 08, 2014 at 06:33:31PM +0100, MRAB wrote: The log of a negative number is a complex number. Only in complex arithmetic. In real arithmetic, the log of a negative number isn't a number at all. -- Steven ___ Python-Dev mailing list

Re: [Python-Dev] Updates to PEP 471, the os.scandir() proposal

2014-07-08 Thread Ethan Furman
On 07/08/2014 06:08 PM, Ben Hoyt wrote: Just like an attribute does not imply a system call, having a method named 'is_dir' /does/ imply a system call, and not having one can be just as misleading. Why does a method imply a system call? os.path.join() and str.lower() don't make system calls.

Re: [Python-Dev] == on object tests identity in 3.x

2014-07-08 Thread Raymond Hettinger
On Jul 7, 2014, at 4:37 PM, Andreas Maier andreas.r.ma...@gmx.de wrote: I do not really buy into the arguments that try to show how identity and value are somehow the same. They are not, not even in Python. The argument I can absolutely buy into is that the implementation cannot be