[Python-ideas] Re: Add parse_duration to datetime - a golang like fucntion to parse duration

2020-08-23 Thread Stephen J. Turnbull
Richard Damon writes: > One issue with allowing Months here is then suddenly an interval > becomes dependent on when it is, so needs to be keep in a complex > form, as a month (and year) are variable length time units. This is the paradigmatic reason why I don't want this in the stdlib. There'

[Python-ideas] Re: Add parse_duration to datetime - a golang like fucntion to parse duration

2020-08-23 Thread Richard Damon
On 8/23/20 7:21 AM, Stephen J. Turnbull wrote: > Richard Damon writes: > > > One issue with allowing Months here is then suddenly an interval > > becomes dependent on when it is, so needs to be keep in a complex > > form, as a month (and year) are variable length time units. > > This is the para

[Python-ideas] Re: Add parse_duration to datetime - a golang like fucntion to parse duration

2020-08-23 Thread Stephen J. Turnbull
Richard Damon writes: > As for holidays, why do holidays matter for time. They don't. They matter for durations, because humans regularly do things like schedule a meeting for "one week from today" and then have to it because it will fall on a holiday observed by their employer. Why use units l

[Python-ideas] Re: Add parse_duration to datetime - a golang like fucntion to parse duration

2020-08-23 Thread Richard Damon
On 8/23/20 8:16 AM, Stephen J. Turnbull wrote: > Richard Damon writes: > > > As for holidays, why do holidays matter for time. > > They don't. They matter for durations, because humans regularly do > things like schedule a meeting for "one week from today" and then have > to it because it will fa

[Python-ideas] Re: Add parse_duration to datetime - a golang like fucntion to parse duration

2020-08-23 Thread Paul Moore
On Sat, 22 Aug 2020 at 13:08, Oz wrote: > > Hi Everyone, > > I really like how go parses durations: > > ``` > hours, _ := time.ParseDuration("10h") > complex, _ := time.ParseDuration("1h10m10s") > micro, _ := time.ParseDuration("1µs") > // The package also accepts t

[Python-ideas] Re: Changing item dunder method signatures to utilize positional arguments (open thread)

2020-08-23 Thread Stefano Borini
On Sat, 8 Aug 2020 at 05:12, Ricky Teachey wrote: > The semantic meaning of m[1, 2, a=3, b=2] might be made to mean: > > 5.m.__getx__(1, 2, a=3, b=4) > > ...which would in turn call, by default: > > m.__getitem__((1, 2), a=3, b=4) I am currently in the process of scouting the whole set of thr

[Python-ideas] Deferred, coalescing, and other very recent reference counting optimization

2020-08-23 Thread Raihan Rasheed Apurbo
In CPython we have reference counting. My question is can we optimize current RC using strategies like Deferred RC and Coalescing? If no then where would I face problem if I try to implement these sorts of strategies? These strategies all depend on the concept that we don't need the exact value

[Python-ideas] Re: basic matrix object

2020-08-23 Thread Oscar Benjamin
On Mon, 17 Aug 2020 at 07:14, Stephen J. Turnbull wrote: > > Christopher Barker writes: > > > Anyway, I would like to see a nice linear algebra lib -- but not 'cause I'd > > use it, only because I find it interesting. > > SymPy. > > Except that in this conversation, "linear algebra" is likely ne

[Python-ideas] Re: Changing item dunder method signatures to utilize positional arguments (open thread)

2020-08-23 Thread Ricky Teachey
On Sun, Aug 23, 2020 at 10:48 AM Stefano Borini wrote: > When you have a getitem operation, you are acting on a set of axes. > e.g. a[4,5,6] acts on three axes. The first axis index is 4, the > second is 5 and the third is 6. > These axes currently are anonymous, but the whole idea is that a name

[Python-ideas] Re: Deferred, coalescing, and other very recent reference counting optimization

2020-08-23 Thread Inada Naoki
Python's cyclic GC collector uses exact reference count. See https://devguide.python.org/garbage_collector/ for detail. On Mon, Aug 24, 2020 at 12:29 AM Raihan Rasheed Apurbo wrote: > > In CPython we have reference counting. My question is can we optimize current > RC using strategies like Defer

[Python-ideas] Enhancement: Adding support for private and name mangled type hints in dataclasses module

2020-08-23 Thread zachb1996--- via Python-ideas
I have a proposal for an addition to the dataclasses module that I think would make it easier to use private and name mangled variables. One of the benefits of the dataclass decorator is that it helps lessen the amount of code when you just need a simple constructor. A common pattern in python th

[Python-ideas] Re: Changing item dunder method signatures to utilize positional arguments (open thread)

2020-08-23 Thread Steven D'Aprano
On Sun, Aug 23, 2020 at 03:47:59PM +0100, Stefano Borini wrote: > I am currently in the process of scouting the whole set of threads and > rewrite PEP-472, somehow. > but just as a 2 cents to the discussion, the initial idea was focused > on one thing only: give names to axes. That is one of the

[Python-ideas] PEP 472 - slices in keyword indices, d[x=1:3]

2020-08-23 Thread Todd
I think it is worth directly discussing the availability of slices in PEP 472-style keyword indices, since we seem to have mostly converged on a dunder method signature. This is an issue that has been alluded to regarding keyword-based (labelled) indices but not directly addressed. The basic synt

[Python-ideas] Re: basic matrix object

2020-08-23 Thread Stephen J. Turnbull
Oscar Benjamin writes: > On Mon, 17 Aug 2020 at 07:14, Stephen J. Turnbull > wrote: > > SymPy. > > > > Except that in this conversation, "linear algebra" is likely neither > > restricted to linearity nor so much algebraic as computational, so > > SymPy likely won't do. :-/ > SymPy is exa

[Python-ideas] Re: PEP 472 - slices in keyword indices, d[x=1:3]

2020-08-23 Thread Christopher Barker
On Sun, Aug 23, 2020 at 6:42 PM Todd wrote: > I think it is worth directly discussing the availability of slices in PEP > 472-style keyword indices, > +1 on slices in all indexing. But thus brings up a broader question: Why not allow slice syntax as an expression everywhere? Everywhere I’ve tr