Hi Augustin, my name Is Giuseppe, i before u :)
At this point I think we can agree on why we disagree :-)
>
Great!
> First, I believe that the function responsible for converting datetimes
> stored in ISO 8601 format in SQLite databases should parse ISO 8601 and not
> do anything else. I'm -1 o
Hello Guiseppe,
At this point I think we can agree on why we disagree :-)
First, I believe that the function responsible for converting datetimes
stored in ISO 8601 format in SQLite databases should parse ISO 8601 and not
do anything else. I'm -1 on changing it to accept localized datetimes. (A
t
Thank you Andreas, finally I can see a real benchmark on my laptop:
python3 -m timeit -s "from django.utils.dateparse import parse_datetime"
"print(parse_datetime('2018-04-01 09:07:04'))"
10 loops, best of 3: 11.1 usec per loop
python3 -m timeit -s "import datetime"
"print(datetime.datetime.s
On 4 Feb 2019, at 15:04, Giuseppe De Marco wrote:
>
> python3 -m timeit -s "import sys, os; sys.path.append(os.getcwd()); from
> datetime_heuristic_parser import datetime_heuristic_parser;
> print(datetime_heuristic_parser('04/12/2018 09:7:4Z'))"
That command is not correct. timeit -s takes
I also added tzinfo as it come from parse_date, I just copy some code and
make get_fixed_timezone as a FixedTimeZone classmethod.
Regarding our doubts about benchmarks, you'll always find them commented in
the top of the file, I hope to make them as many immediate as possible to
avoid waste of time
For me, I get:
In [4]: %timeit datetime_heuristic_parser('2019-02-03T17:27:58.645194')
18.9 µs ± 431 ns per loop (mean ± std. dev. of 7 runs, 10 loops each)
And for Django:
In [3]: %timeit parse_datetime('2019-02-03T17:27:58.645194')
6.97 µs ± 408 ns per loop (mean ± std. dev. of 7 runs, 10
Hello everyone, first of all I am grateful for your time and your attention.
@Tom Forbes
The first time I runned it I thought the same thing! Please use
https://github.com/peppelinux/Django-snippets/blob/master/datetime_heuristic_parser.py
and not the previous pasted one. I'm quite sure that all t
Hello Guiseppe,
In which circumstances:
- would this be useful?
- would a Form not be a better choice?
Best regards,
--
Aymeric.
> On 4 Feb 2019, at 00:10, Giuseppe De Marco wrote:
>
> Hi Aymeric,
>
> Thank you for the answer and for the tests as well.
> I understand and also agree your
I’m pretty sure 0.0241 usec per loop is either a typo or a mistake during
benchmarking. I’ve got no comment what you’re proposing but correct and
valid benchmarks are important, so I would double check that.
On 3 February 2019 at 23:37:14, Giuseppe De Marco (
giuseppe.dema...@unical.it) wrote:
Regarding the previous example,
better to read it here (my fault: I mistaken the format
'%Y-%m-%dT%H:%M:%S.%f'):
https://github.com/peppelinux/Django-snippets/blob/master/datetime_heuristic_parser.py
and also, it should came also with tzinfo regexp and other functions as
well, like parse_date time
Hi Aymeric,
Thank you for the answer and for the tests as well.
I understand and also agree your vision on all the line, I got the specific
purpose of parse_date.
I'd like to introduce a generalized way to parse date and datetime string
based on Django project configuration, in settings.py.
It cou
Hello Guiseppe,
django.utils.dateparse provides helpers needed by Django to implement datetime,
date and time fields on SQLite. (SQLite doesn't have a native date time type.)
Their job is to parse ISO 8601 fast. That's it.
A utility module should do exactly what Django needs and nothing more.
12 matches
Mail list logo