On 07/13/2014 10:33 PM, Andreas Maier wrote:
Am 14.07.2014 04:55, schrieb Ethan Furman:
On 07/13/2014 08:13 AM, Andreas Maier wrote:
Test #8: Same object of class C
(C.__eq__() implemented with equality of x,
C.__ne__() returning NotImplemented):
obj1: type=, str=C(256), id=3940650
On 07/13/2014 05:33 PM, Ben Hoyt wrote:
On the recent python-dev thread, Victor especially made some well
thought out suggestions. It seems to me there's general agreement that
the basic API in PEP 471 is good (with Ethan not a fan at first, but
it seems he's on board after further discussion :-
On 07/13/2014 08:13 AM, Andreas Maier wrote:
Am 11.07.2014 22:54, schrieb Ethan Furman:
Here is the externally visible behavior:
Python 3.5.0a0 (default:34881ee3eec5, Jun 16 2014, 11:31:20)
[GCC 4.7.3] on linux
Type "help", "copyright", "credits" or "license" for more information.
--> NaN = fl
On 14 July 2014 12:17, Nick Coghlan wrote:
>
> I think os.walk() is a good source of inspiration here: call the flag
> "followlink" and default it to False.
>
Actually, that's "followlinks", and I'd forgotten that os.walk() defaulted
to not follow - definitely behaviour to match IMO :)
Tim Delane
On 13 Jul 2014 20:54, "Tim Delaney" wrote:
>
> On 14 July 2014 10:33, Ben Hoyt wrote:
>>
>>
>>
>> If we go with Victor's link-following .is_dir() and .is_file(), then
>> we probably need to add his suggestion of a follow_symlinks=False
>> parameter (defaults to True). Either that or you have to s
On 14 July 2014 10:33, Ben Hoyt wrote:
>
If we go with Victor's link-following .is_dir() and .is_file(), then
> we probably need to add his suggestion of a follow_symlinks=False
> parameter (defaults to True). Either that or you have to say
> "stat.S_ISDIR(entry.lstat().st_mode)" instead, which
Hi folks,
Thanks Victor, Nick, Ethan, and others for continued discussion on the
scandir PEP 471 (most recent thread starts at
https://mail.python.org/pipermail/python-dev/2014-July/135377.html).
Just an aside ... I was reminded again recently why scandir() matters:
a scandir user emailed me the
>> Very much agreed that this isn't necessary for just readdir/FindNext
>> errors. We've never had this level of detail before -- if listdir()
>> fails half way through (very unlikely) it just bombs with OSError and
>> you get no entries at all.
>>
>> If you really really want this (again very unli
Nick Coghlan writes:
...
> definition of floats and the definition of container invariants like
> "assert x in [x]")
>
> The current approach means that the lack of reflexivity of NaN's stays
> confined to floats and similar types - it doesn't leak out and infect
> the behaviour of the container t
Nick Coghlan :
> Right, it's not a mere optimisation - it's the only way to get
> containers to behave sensibly. Otherwise we'd end up with nonsense
> like:
>
x = float("nan")
x in [x]
> False
Why is that nonsense? I mean, why is it any more nonsense than
>>> x == x
False
Anyway
On 13 July 2014 13:43, wrote:
> In its previous form, the PEP seemed more focused on some false
> optimization capabilities of a read-only type, rather than as here, the
> far more interesting hashability properties. It might warrant a fresh
> PEP to more thoroughly investigate this angle.
RIght
On Sun, Jul 13, 2014 at 06:43:28PM +, dw+python-...@hmmz.org wrote:
> if d:
> d = d.copy()
To cope with iterables, "d = d.copy()" should have read "d = dict(d)".
David
___
Python-Dev mailing list
Python-Dev@python.org
h
On Sun, Jul 13, 2014 at 02:04:17PM +, Jason R. Coombs wrote:
> PEP-416 mentions a MappingProxyType, but that’s no help.
Well, it kindof is. By combining MappingProxyType and UserDict the
desired effect can be achieved concisely:
import collections
import types
class frozendict(c
On 13 July 2014 13:16, Chris Angelico wrote:
> On Mon, Jul 14, 2014 at 4:11 AM, Nick Coghlan wrote:
>> What we've never figured out is a good place to *document* it. I
>> thought there was an open bug for that, but I can't find it right now.
>
> Yeah. The Py3 docs explain why "x in [x]" is True,
On Mon, Jul 14, 2014 at 4:11 AM, Nick Coghlan wrote:
> What we've never figured out is a good place to *document* it. I
> thought there was an open bug for that, but I can't find it right now.
Yeah. The Py3 docs explain why "x in [x]" is True, but I haven't found
a parallel explanation of sequenc
On 13 July 2014 11:34, Chris Angelico wrote:
> On Mon, Jul 14, 2014 at 2:23 AM, Steven D'Aprano wrote:
>>> We will see
>>> later that that happens. Further, when comparing float NaNs of the same
>>> identity, the list implementation forgot to special-case NaNs. Which
>>> would be a bug, IMHO.
>>
I find it handy to use named tuple as my database mapping type. It allows you
to perform this behavior seamlessly.
-Mark
> On Jul 13, 2014, at 7:04, "Jason R. Coombs" wrote:
>
> I repeatedly run into situations where a frozendict would be useful, and
> every time I do, I go searching and fin
On Mon, Jul 14, 2014 at 2:23 AM, Steven D'Aprano wrote:
>> We will see
>> later that that happens. Further, when comparing float NaNs of the same
>> identity, the list implementation forgot to special-case NaNs. Which
>> would be a bug, IMHO.
>
> "Forgot"? I don't think the behaviour of list compa
On Sun, Jul 13, 2014 at 05:13:20PM +0200, Andreas Maier wrote:
> Second, if not by delegation to equality of its elements, how would the
> equality of sequences defined otherwise?
Wow. I'm impressed by the amount of detailed effort you've put into
investigating this. (Too much detail to absorb,
Am 11.07.2014 22:54, schrieb Ethan Furman:
On 07/11/2014 07:04 AM, Andreas Maier wrote:
Am 09.07.2014 03:48, schrieb Raymond Hettinger:
Personally, I see no need to make the same mistake by removing
the identity-implies-equality rule from the built-in containers.
There's no need to upset the a
On Mon, Jul 14, 2014 at 12:04 AM, Jason R. Coombs wrote:
> I can achieve what I need by constructing a set on the ‘items’ of the dict.
>
set(tuple(doc.items()) for doc in res)
>
> {(('n', 1), ('err', None), ('ok', 1.0))}
This is flawed; the tuple-of-tuples depends on iteration order, which
m
The PEP has been rejected, but the MappingProxyType is now public:
$ ./python
Python 3.5.0a0 (default:5af54ed3af02, Jul 12 2014, 03:13:04)
>>> d={1:2}
>>> import types
>>> d = types.MappingProxyType(d)
>>> d
mappingproxy({1: 2})
>>> d[1]
2
>>> d[1] = 3
Traceback (most recent call last):
File "",
I repeatedly run into situations where a frozendict would be useful, and every
time I do, I go searching and find the (unfortunately rejected) PEP-416. I'd
just like to share another case where having a frozendict in the stdlib would
be useful to me.
I was interacting with a database and had a
23 matches
Mail list logo