On Mon, May 11, 2020 at 10:41:06AM -0700, Andrew Barnert via Python-ideas wrote:
> I think in general people will expect that a slice view on a sequence
> acts like “some kind of sequence”, not like the same kind they’re
> viewing—again, they won’t be surprised if you can’t insert into a
> slic
On Sun, May 10, 2020 at 09:36:14PM -0700, Andrew Barnert via Python-ideas wrote:
> > for i in itertools.seq_view(a_list)[::2]:
> > ...
> >
> > I still think I prefer this though:
> >
> > for i in a_list.view[::2]:
> > ...
>
> Agreed. A property on sequences would be best,
Why?
This
On 14/05/2020 03:54, Greg Ewing wrote:
On 14/05/20 8:55 am, Richard Damon wrote:
On 5/13/20 2:03 PM, Rhodri James wrote:
I'm sorry, but I think the correct response is to give them a spanking
in code review. I certainly wouldn't pass any code that actually
relied on assert doing anything.
M
On 5/13/20 10:54 PM, Greg Ewing wrote:
> On 14/05/20 8:55 am, Richard Damon wrote:
>> On 5/13/20 2:03 PM, Rhodri James wrote:
>>>
>>> I'm sorry, but I think the correct response is to give them a spanking
>>> in code review. I certainly wouldn't pass any code that actually
>>> relied on assert doi
Hi,
It would be helpful for us if tracemalloc had a function that reset the peak
memory usage counter, without clearing the current traces. At the moment, I
don't think there's a way to find the peak memory of a subset of the code since
the initial tracemalloc.start() call, without calling
tra
Hi,
The following function is completely reasonable. It shouldn't be hard
to implement it (a few lines of C code).
def reset_peak_memory():
# in _tracemalloc.c
tracemalloc_peak_trace_memory = tracemalloc_traced_memory;
Reset the peak to tracemalloc_traced_memory is correct :-
On Thu, May 14, 2020 at 2:58 AM Steven D'Aprano wrote:
> On Mon, May 11, 2020 at 10:41:06AM -0700, Andrew Barnert via Python-ideas
> wrote:
>
> > I think in general people will expect that a slice view on a sequence
> > acts like “some kind of sequence”, not like the same kind they’re
> > viewing
On Thu, May 14, 2020 at 3:32 AM Steven D'Aprano wrote:
> On Sun, May 10, 2020 at 09:36:14PM -0700, Andrew Barnert via Python-ideas
> wrote:
> > > for i in itertools.seq_view(a_list)[::2]:
> > > ...
> > >
> > > I still think I prefer this though:
> > >
> > > for i in a_list.view[::2]:
>
> > Ag
On May 14, 2020, at 03:01, Steven D'Aprano wrote:
>
> On Mon, May 11, 2020 at 10:41:06AM -0700, Andrew Barnert via Python-ideas
> wrote:
>
>> I think in general people will expect that a slice view on a sequence
>> acts like “some kind of sequence”, not like the same kind they’re
>> viewing—
On 14/05/2020 17:47, Andrew Barnert via Python-ideas wrote:
Which is exactly why Christopher said from the start of this thread,
and everyone else has agreed at every step of the way, that we can’t
change the default behavior of slicing, we have to instead add some
new way to specifically ask for
On May 14, 2020, at 03:35, Steven D'Aprano wrote:
>
> On Sun, May 10, 2020 at 09:36:14PM -0700, Andrew Barnert via Python-ideas
> wrote:
>
>
>>> for i in itertools.seq_view(a_list)[::2]:
>>>...
>>>
>>> I still think I prefer this though:
>>>
>>> for i in a_list.view[::2]:
>>>...
>
>
> So that means a view() function (with maybe a different name) -- however,
> that brings up the issue of where to put it. I'm not sure that it warrants
> being in builtins, but where does it belong? Maybe the collections module?
> And I really think the extra import would be a barrier.
>
>
It oc
On May 14, 2020, at 10:45, Rhodri James wrote:
>
> On 14/05/2020 17:47, Andrew Barnert via Python-ideas wrote:
>> Which is exactly why Christopher said from the start of this thread,
>> and everyone else has agreed at every step of the way, that we can’t
>> change the default behavior of slicing
On May 14, 2020, at 11:53, Ricky Teachey wrote:
>
>> So that means a view() function (with maybe a different name) -- however,
>> that brings up the issue of where to put it. I'm not sure that it warrants
>> being in builtins, but where does it belong? Maybe the collections module?
>> And I re
I've opened https://bugs.python.org/issue40630 and I'd definitely be keen on
implementing it. I'll try to open a PR sometime later today or over the weekend.
Thanks for the quick feedback!
Huon
___
Python-ideas mailing list -- [email protected]
T
Executive summary:
AFAICT, my guess at what's going on in the C tokenizer was exactly
right. It greedily consumes as many non-operator, non-whitespace
characters as possible, then validates. It does this because it is
tokenizing a stream of bytes encoding characters as UTF-8.
Andrew Barnert via
Andrew Barnert writes:
> Maybe we need to come up with a word that can’t possibly have any
> existing meaning to anyone, like Standard Oil did with “Exxon”.
Unfortunately, I doubt such a word can be trademarked, so somebody
else will borrow it with a slightly different meaning that becomes
more
Andrew Barnert writes:
> And I’m pretty sure that’s exactly the confusion that led you to
> think that dict_keys have weird behavior,
That wasn't me I'm here to discuss documentation, not dict or
sequence views. ;-) Changing the subject field to match.
> Students often want to know why
On Fri, May 15, 2020 at 1:19 PM Stephen J. Turnbull
wrote:
> ISTM that all we need to say is that
>
> 1. An *iterator* is a Python object whose only necessary function is
> to return an object when next is applied to it. Its purpose is to
> keep track of "next" for *for*. (It might do o
19 matches
Mail list logo