[issue45466] Simple curl/wget-like download functionality in urllib (like http offers server)

2021-11-11 Thread Tom Pohl
Change by Tom Pohl : -- nosy: -tom.pohl ___ Python tracker <https://bugs.python.org/issue45466> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue45466] Simple curl/wget-like download functionality in urllib (like http offers server)

2021-10-25 Thread Tom Pohl
Tom Pohl added the comment: Thanks, Terry, for the hint. The idea got some support on python-ideas, so I thought it is worthwhile to do a PR. As a first-time contributor, I now have to wait for approval for the pipeline to run... -- ___ Python

[issue45466] Simple curl/wget-like download functionality in urllib (like http offers server)

2021-10-14 Thread Tom Pohl
New submission from Tom Pohl : In the context of building Docker images, it is often required to download stuff. If curl/wget are available, great, but often slim images don't offer that. The urllib could provide a very simple download functionality (like http offers a simple server

[issue39671] Mention in docs that asyncio.FIRST_COMPLETED does not guarantee the completion of no more than one task

2020-02-18 Thread Tom Pohl
New submission from Tom Pohl : Currently, the documentation of asyncio.wait gives the impression that using FIRST_COMPLETED guarantees the completion of no more than one task. In reality, the number of completed task after asyncio.wait can be larger than one. While this behavior (exactly one

[issue24823] ctypes.create_string_buffer does not add NUL if len(init) == size

2015-08-07 Thread Tom Pohl
New submission from Tom Pohl: From the ctypes.create_string_buffer docs: If a bytes object is specified as first argument, the buffer is made one item larger than its length so that the last element in the array is a NUL termination character. An integer can be passed as second argument which

[issue24823] ctypes.create_string_buffer does not add NUL if len(init) == size

2015-08-07 Thread Tom Pohl
Tom Pohl added the comment: I agree: not every buffer is null-terminated. But the function name suggests that it creates a _string_ buffer which will most likely be used as an input to a C function. There, it can easily trigger a buffer overflow without a null termination which can

[issue24823] ctypes.create_string_buffer does not add NUL if len(init) == size

2015-08-07 Thread Tom Pohl
Tom Pohl added the comment: If one needs to set a general buffer (i.e. not a null-terminated string buffer) one could always use: string = (ctypes.c_char*4)() string.raw = b'abcd' -- ___ Python tracker rep...@bugs.python.org http

[issue16460] Strange results for floor division (//) with non-integer divisors

2012-11-14 Thread Tom Pohl
Tom Pohl added the comment: Mark, thanks for explaining the connection of // and %. Finally, I can see why somebody would want to stick to the current behavior of FD. It renders FD useless for all of my use cases, but there are simple alternatives. Thanks for your time, Tom

[issue16460] Strange results for floor division (//) with non-integer divisors

2012-11-13 Thread Tom Pohl
Tom Pohl added the comment: You still get me wrong. Thanks to your explanations and to my personal knowledge about this topic (programming for 28 years now; PhD in CS/numerics/HPC) I now fully understand the technical details about the current implementation of FD. The problem I see

[issue16460] Strange results for floor division (//) with non-integer divisors

2012-11-13 Thread Tom Pohl
Tom Pohl added the comment: This is a fact-of-life for anyone using binary floating point: x = 0.0 while x != 1.0: print(x); x += 0.1 # so long This is not: 1 // 0.1 = 9.0 because math.floor(1/0.1) is able to come up with the result that is expected from an operator called floor division

[issue16460] Strange results for floor division (//) with non-integer divisors

2012-11-12 Thread Tom Pohl
New submission from Tom Pohl: According to the documentation of the floor division (http://docs.python.org/2/reference/expressions.html#binary-arithmetic-operations), x//y should be equal to math.floor(x/y). However, the result of 1//0.1 is 9.0 (tested on 2.6, 2.7, 3.2). It might be related

[issue16460] Strange results for floor division (//) with non-integer divisors

2012-11-12 Thread Tom Pohl
Tom Pohl added the comment: Thanks for your comments. From a technical/numerical point of view I agree with you that the computed result is correct given the floating-point limitations. From a user's point of view (and the documentation seems to agree with me) the result is wrong

[issue16460] Strange results for floor division (//) with non-integer divisors

2012-11-12 Thread Tom Pohl
Tom Pohl added the comment: Thanks for all the explanations why Python's floor division (FD) works as specified. And I agree, it does work as specified, but still, I think this is not the behavior that most people would expect and is therefore dangerous to provide/use. What do I expect from

[issue16460] Strange results for floor division (//) with non-integer divisors

2012-11-12 Thread Tom Pohl
Tom Pohl added the comment: Martin: Ok, just as you suggested, I did the calculations on a sheet of paper: floor(1 mathematically-divided-by 0.1) = floor(10) = 10 qed ;-) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org

[issue16460] Strange results for floor division (//) with non-integer divisors

2012-11-12 Thread Tom Pohl
Tom Pohl added the comment: Since nobody seems to share my point of view, I give up. :-) Thanks for your support and for working on Python (the best programming language as we all know), Tom -- ___ Python tracker rep...@bugs.python.org http