On Wed, Mar 08, 2017 at 01:20:19AM +, Erik wrote:
> >Part of the complexity here is that I'd like this flag to be available
> >to Python code, not just a hidden internal state of the list.
>
> Out of interest, for what purpose? Generally, I thought Python code
> should not need to worry abou
Hello everyone,
I'm shortly writing to you about a reflection I lately made upon the
current functioning of __str__ for the time's class.
Before expressing my thought and proposal, I want to make sure we all agree
on a simple and clear fact:
the __str__ magic method is used to give a literal and
> On 8 Mar 2017, at 16:01, Francesco Franchina wrote:
>
> Hello everyone,
>
> I'm shortly writing to you about a reflection I lately made upon the current
> functioning of __str__ for the time's class.
>
> Before expressing my thought and proposal, I want to make sure we all agree
> on a sim
On 03/08/2017 08:01 AM, Francesco Franchina wrote:
Before expressing my thought and proposal, I want to make sure we all agree on
a simple and clear fact:
the __str__ magic method is used to give a literal and human-readable
representation to the object (unlike __repr__).
If __str__ has not
On 08/03/17 11:07, Steven D'Aprano wrote:
I mentioned earlier that I have code which has to track the type of list
items, and swaps to a different algorithm when the types are not all the
same.
Hmmm. Yes, I guess if the expensive version requires a lot of
isinstance() messing or similar for ea
Can you assume that list of of type(list[0]) and use that type's optimised sort?
But in the optimised sort code check that the types are as required.
If you hit an element that is not of the required type then fall back to the
unoptimised sort.
So part of list is sorted using optimised code and t
Hi All,
I find importing defaultdict from collections to be clunky and it seems
like having a default should just be an optional keyword to dict. Thus,
something like,
d = dict(default=int)
would be the same as
from collections import defaultdict
d = defaultdict(int)
Any thoughts?
Thanks,
That's already valid dict syntax.
>>> dict(default=int)
{'default': }
Generally that in itself makes this a no go.
Mahmoud
On Wed, Mar 8, 2017 at 2:09 PM, Steven Piantadosi
wrote:
> Hi All,
>
> I find importing defaultdict from collections to be clunky and it seems
> like having a default sho
On Thu, Mar 9, 2017 at 9:23 AM, Brice PARENT wrote:
> Would those 2 dicts be equal ?
> d1 = dict(default=5)
> d2 = {'default': 5}
Easy to find out:
>>> d1 = dict(default=5)
>>> d2 = {'default': 5}
>>> d1 == d2
True
ChrisA
___
Python-ideas mailing list
On Thu, Mar 9, 2017 at 9:39 AM, Brice PARENT wrote:
> But a possible workaround, is if we used the first positional argument of
> dict() as the default value. As right now it doesn't accept positional
> arguments (or at least if they are not iterable, which complicates a bit the
> thing), we could
On 3/8/2017 5:43 PM, Chris Angelico wrote:
On Thu, Mar 9, 2017 at 9:39 AM, Brice PARENT wrote:
But a possible workaround, is if we used the first positional argument of
dict() as the default value. As right now it doesn't accept positional
arguments (or at least if they are not iterable, which
On Wed, Mar 8, 2017 at 2:14 PM Barry wrote:
> Can you assume that list of of type(list[0]) and use that type's optimised
> sort?
> But in the optimised sort code check that the types are as required.
> If you hit an element that is not of the required type then fall back to
> the unoptimised sort
On Thu, 09 Mar 2017 09:43:48 +1100, Chris Angelico wrote:
> On Thu, Mar 9, 2017 at 9:39 AM, Brice PARENT wrote:
>> But a possible workaround, is if we used the first positional
>> argument of dict() as the default value [...]
> ... Granted, there aren't going to be very many objects that are bot
On Wed, Mar 8, 2017 at 2:58 PM, Elliot Gorokhovsky <
elliot.gorokhov...@gmail.com> wrote:
>
> The whole point of my patch is that we do O(nlogn) compares, but only have
> O(n) elements, so it's much cheaper to do all the type checks in advance,
>
> I mean, practically speaking, the advance chec
14 matches
Mail list logo