[issue39784] Tuple comprehension

2020-02-28 Thread Steven D'Aprano
Steven D'Aprano added the comment: This was discussed on Python-Ideas: https://mail.python.org/archives/list/python-id...@python.org/message/LSGZF3G4RFVTKXB5Y2EW5USL2JANG5RS/ and on Discuss: https://discuss.python.org/t/why-no-tuple-comprehension/2820/1 In both cases the consensu

[issue39784] Tuple comprehension

2020-02-28 Thread Steven D'Aprano
Steven D'Aprano added the comment: Regarding performance, on my computer, the overhead of calling tuple() on a list comp ranges from about 30% for tiny sequences down to about 5% for largish sequences. Tiny sequences are fast either way: [steve@ando cpython]$ ./python -m timeit &quo

[issue39788] Exponential notation should return an int if it can

2020-02-28 Thread Steven D'Aprano
Steven D'Aprano added the comment: I agree with both Eric and Zachary, but I just wanted to point out that in a Python interpreter with a keyhole optimizer, you can expect that expressions like `1*10**9` to be a constant: # Python 3.5 py> from dis import dis py> dis(&#x

[issue39800] Inconsistent/incomplete disassembly of methods vs method source code

2020-02-29 Thread Steven D'Aprano
Steven D'Aprano added the comment: > would it not be better to for dis.dis to behave consistently for methods and > source strings of methods I don't think so. The inputs are different. One is a string containing a `def` statement, which is an executable statement. The oth

[issue39788] Exponential notation should return an int if it can

2020-02-29 Thread Steven D'Aprano
Steven D'Aprano added the comment: > Integers are implicitly converted to floats in operations with floats. > How can this change break old code? # Status quo print(1e60 + 1) => prints 1e+60 # In the future: => prints 10

[issue39805] Copying functions doesn't actually copy them

2020-02-29 Thread Steven D'Aprano
New submission from Steven D'Aprano : Function objects are mutable, so I expected that a copy of a function should be an actual independent copy. But it isn't. py> from copy import copy py> a = lambda: 1 py> b = copy(a) py> a is b True This burned

[issue39800] Inconsistent/incomplete disassembly of methods vs method source code

2020-02-29 Thread Steven D'Aprano
Steven D'Aprano added the comment: > BTW how else are methods/functions are created in Python except via def? Functions are objects like everything else in Python, so they have a type, which has a constructor: from types import FunctionType The documentation for FunctionType

[issue39805] Copying functions doesn't actually copy them

2020-02-29 Thread Steven D'Aprano
Steven D'Aprano added the comment: I think this is sufficient for a shallow copy. import copy import types def copyfunction(func): new = types.FunctionType( func.__code__, func.__globals__, func.__name__, func.__defaults__,

[issue39800] Inconsistent/incomplete disassembly of methods vs method source code

2020-02-29 Thread Steven D'Aprano
Steven D'Aprano added the comment: Ah, I see now. I was using an older version of Python and the output of dis was different. It didn't recurse in to show the disassembly of the code object as well. > The first block of instructions here are for the def statement, and >

[issue30988] Exception parsing invalid email address headers starting or ending with dot

2020-03-03 Thread Steven Hilton
Change by Steven Hilton : -- nosy: +Steven Hilton nosy_count: 5.0 -> 6.0 pull_requests: +18121 pull_request: https://github.com/python/cpython/pull/18687 ___ Python tracker <https://bugs.python.org/issu

[issue39864] IndexError gives wrong axis info

2020-03-05 Thread Steven D'Aprano
Steven D'Aprano added the comment: This is a numpy issue, you will need to report it to the numpy developers. But first you need to check that it really is a bug. What makes you think it is a bug? In your example, index 3 looks out of bounds to me. Remember that indexes start at 0,

[issue39880] string.lstrip() with leading '3's

2020-03-06 Thread Steven D'Aprano
Change by Steven D'Aprano : -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.pyth

[issue39902] dis.Bytecode objects should be comparable

2020-03-08 Thread Steven D'Aprano
Steven D'Aprano added the comment: What does it mean for two Bytecode objects to be equal? I know what equality means for ints: they have the same numeric value. I know what equality means for strings: they have the same sequence of Unicode code points. I have no concept of what it

[issue39928] Pysftp Issue File Upload is not working - put command

2020-03-10 Thread Steven D'Aprano
Change by Steven D'Aprano : -- resolution: -> third party stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.pyth

[issue39939] Add str methods to remove prefixes or suffixes

2020-03-12 Thread Steven D'Aprano
Steven D'Aprano added the comment: To be clear, are you only making a copy of the unchanged object if it is a mutable bytearray, not str or bytes? -- nosy: +steven.daprano ___ Python tracker <https://bugs.python.org/is

[issue39964] adding a string to a list works differently with x+='' compared to x=x+''

2020-03-14 Thread Steven D'Aprano
Steven D'Aprano added the comment: That's not a bug. The in-place addition `+=` for lists is equivalent to the extend method. See the documentation: https://docs.python.org/3/library/stdtypes.html#mutable-sequence-types and the tutorial: https://docs.python.org/

[issue40032] Remove explicit inheriting of object in class definitions

2020-03-21 Thread Steven D'Aprano
Steven D'Aprano added the comment: Code churn for no good reason is not a good idea. I cannot think of any good reasons to change this: - it doesn't add new functionality; - it doesn't fix bugs; - it doesn't make the code easier to maintain; - it makes the code LESS c

[issue40028] Math module method to find prime factors for non-negative int n

2020-03-21 Thread Steven D'Aprano
Steven D'Aprano added the comment: I don't know... To my mind, if we are going to support working with primes, the minimum API is: - is_prime(n) - next_prime(n) - prev_prime(n) - factorise(n) - generate_primes(start=0) (I trust the names are self-explanatory.) There are var

[issue40028] Math module method to find prime factors for non-negative int n

2020-03-21 Thread Steven D'Aprano
Steven D'Aprano added the comment: Ross: "implement this logic for a limited range of non-negative n, imposing an upper limit (suggestions welcome) to make sure all provided input can be safely processed. We can then build from there to support larger n going forward if the dem

[issue40032] Remove explicit inheriting of object in class definitions

2020-03-21 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Sat, Mar 21, 2020 at 01:30:13PM +, Julin wrote: > Why do you think it makes the code less clear, though? Classes that inherit from object, and those which don't ("classic classes") behave differently in Python 2. But in Python

[issue40113] Turtle demo

2020-03-30 Thread Steven D'Aprano
Steven D'Aprano added the comment: Perhaps this is just my old eyes, but I can't see where the turtle is going backwards. I can see it spinning, but it's not clear that the turtle position is moving backwards or if it is an illusion caused by the turtle spinning around. I

[issue40113] Turtle demo

2020-03-30 Thread Steven D'Aprano
Steven D'Aprano added the comment: Try changing the turtle to the arrow pointer and see if you can still see backwards movement. james.shape('arrow') -- ___ Python tracker <https://bugs.pyt

[issue40123] append() works not correct

2020-03-31 Thread Steven D'Aprano
Change by Steven D'Aprano : -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.pyth

[issue40113] Turtle demo

2020-03-31 Thread Steven D'Aprano
Steven D'Aprano added the comment: > the program is supposed to draw a function like y=sin(x) but is drawing > y=abs(sin(x)). It would have been nice if you had described the problem this way from your initial bug report, instead of saying that the turtle was moving backwards. I

[issue40177] Python Language Reference Documentation

2020-04-03 Thread Steven D'Aprano
Steven D'Aprano added the comment: How about this? "The not-a-number values ``float('NaN')`` and ``decimal.Decimal('NaN')`` are special. Not-a-number values always compare unordered and unequal to any other value, including themselves. For example, if ``x =

[issue40177] Python Language Reference Documentation

2020-04-03 Thread Steven D'Aprano
Steven D'Aprano added the comment: Oops, that should be ... ``x == x``, ``3 < x``, and ``x > 3`` are all false ... -- ___ Python tracker <https://bugs.python.

[issue40177] Python Language Reference Documentation

2020-04-03 Thread Steven D'Aprano
Steven D'Aprano added the comment: Oh never mind, I'm just going to slink away now and stop posting corrections when distracted... -- ___ Python tracker <https://bugs.python.o

[issue40191] tempfile.mkstemp() | Documentation Error

2020-04-04 Thread Steven D'Aprano
Steven D'Aprano added the comment: I think you may have misread the documentation. It says: "an OS-level handle to an open file" which is what you call a file descriptor. Not a file object, which is what you get by calling the builtin `open`, but a file handle like you g

[issue40202] Misleading grammatically of ValueError Message?

2020-04-06 Thread Steven D'Aprano
Steven D'Aprano added the comment: I think the error messages could be improved. In the first example: `f,x, a, b = [1,2,3]` you are unpacking three values, but you need to unpack 4. The error message is not very helpful: 5 values is "more than 3" but it would be too many

[issue40206] Multiplying 4.6*100 will result in 459.99999999999994

2020-04-06 Thread Steven D'Aprano
Steven D'Aprano added the comment: Rémi, it is not true that the Decimal module won't lose precision. It will. Decimal is not exact either, it is still a floating point format similar to float. py> Decimal(1)/3*3 Decimal('0.') The two majo

[issue40229] tty unblocking setraw and save-restore features

2020-04-08 Thread Steven Lu
New submission from Steven Lu : I hope to be able to set blocking or unblocking in `tty.setraw` so that I won't need to mess with `termios` in every of my python codes using an unblocking raw mode. I will personally find it useful in the situation where I want a mainloop that cont

[issue40202] Misleading grammatically of ValueError Message?

2020-04-09 Thread Steven D'Aprano
Steven D'Aprano added the comment: > Since the original report was about 2.7 which is no longer maintained, > I propose to close this issue as outdated. For what it's worth, I'm okay with closing. -- ___ Python tracker <

[issue40248] Proposed class for collections: dynamicdict

2020-04-10 Thread Steven D'Aprano
Steven D'Aprano added the comment: This feature is already provided by just supplying a `__missing__` dunder: py> class MyDict(dict): ... def __missing__(self, key): ... return "The key is {}".format(key) ... py> d = MyDict() py> d[1234] 'The ke

[issue40269] Inconsistent complex behavior with (-1j)

2020-04-12 Thread Steven D'Aprano
Steven D'Aprano added the comment: Would we be willing to consider an enhancement to have complex numbers always display using float format rather than ints? 1+1j --> 1.0+1.0j We could still suppress an unsigned real zero: 1j --> 1.0j but negative zero would show

[issue40295] doctest handling of multiline strings is broken

2020-04-15 Thread Steven D'Aprano
Steven D'Aprano added the comment: Have you tried calling multiline_output() in the REPL? It does *not* show your expected output: # expected First line Second line but the string repr(): # actual 'First line\nSecond line\n' Change your do

[issue40295] doctest handling of multiline strings is broken

2020-04-15 Thread Steven D'Aprano
Steven D'Aprano added the comment: By the way Filip, you were told on the Stackoverflow page that the output was correct and that you were not using doctest correctly. Serhiy also hinted to you that you should check the output in the REPL and you falsely claimed that it gave the exp

[issue40301] zipfile module: new feature (two lines of code), useful for test, security and forensics

2020-04-16 Thread Steven D'Aprano
Steven D'Aprano added the comment: This is a new feature and cannot be added to older versions which are in feature-freeze. Adding the feature to (say) Python 2.7.18 would be inconsistent, because it wouldn't exist in 2.7.0 through .17. Likewise for all the other versions b

[issue40301] zipfile module: new feature (two lines of code), useful for test, security and forensics

2020-04-17 Thread Steven D'Aprano
Steven D'Aprano added the comment: Sorry Massimo, there are no new features being added to 2.7, not even critical security fixes. That's not my decision. https://www.python.org/doc/sunset-python-2/ Python 2 is effectively now a dead project from the point of view of us here at CP

[issue40326] A string contains an empty string?

2020-04-19 Thread Steven D'Aprano
Steven D'Aprano added the comment: https://docs.python.org/3/reference/expressions.html#membership-test-operations -- nosy: +steven.daprano ___ Python tracker <https://bugs.python.org/is

[issue40353] Add an optional "strict" check to zip

2020-04-21 Thread Steven D'Aprano
Steven D'Aprano added the comment: I don't think this is needed in the builtin zip at all. I think that there is no consensus on Python-Ideas that this is needed or desirable. I especially don't think the API should be a keyword flag on zip. Flag arguments which change t

[issue40353] Add an optional "strict" check to zip

2020-04-21 Thread Steven D'Aprano
Steven D'Aprano added the comment: > independent class Oops, sorry I mean independent implementation. -- ___ Python tracker <https://bugs.python.org

[issue40380] Errors during make test python 3.8.2

2020-04-24 Thread Steven Fleck
New submission from Steven Fleck : I'm having some issues with installing python 3.8.2. I'm installing it in my personal workspace on my university's computing resources (linux). I've installed many programs here, but python is giving me some issues. Ultimately,

[issue40388] random.choice integer overflow v3.5.2

2020-04-25 Thread Steven D'Aprano
Steven D'Aprano added the comment: What you are describing is not what we mean by a crash (a core dump or segfault); it sounds like a regular Python exception. Python 3.5 is obsolete and there are no more bug fixes for it except for security fixes. You have not given us enough inform

[issue40388] random.choice integer overflow v3.5.2

2020-04-25 Thread Steven D'Aprano
Steven D'Aprano added the comment: Take your pick between either of these: random.randrange(1, N) random.randint(1, N-1) https://docs.python.org/3/library/random.html#functions-for-integers -- ___ Python tracker <https://bugs.py

[issue40446] pow(a, b, p) where b=int((p-1)/2) spits out gibbrish for big p

2020-04-29 Thread Steven D'Aprano
Steven D'Aprano added the comment: Hi, The behaviour you are calling "gibbrish" is correct, as the expression `(p-1)/2` calculates a 64-bit floating point number, which may lose precision even for small values of p, but will definitely lose precision for large p. Calling

[issue40028] Math module method to find prime factors for non-negative int n

2020-05-05 Thread Steven D'Aprano
Steven D'Aprano added the comment: Miller-Rabin is known to be deterministic for all N < 2**64 too. To be pedantic, M-R is known to be deterministic if you check every value up to sqrt(N), or possibly 2*log(N) if the generalized Riemann hypothesis is true. The question is whether th

[issue40028] Math module method to find prime factors for non-negative int n

2020-05-05 Thread Steven D'Aprano
Steven D'Aprano added the comment: Speaking of OpenSSL, a few years ago this paper came out about OpenSSL's vulnerability to adversarial composites. Quote: "As examples of our findings, weare able to construct 2048-bit composites that are declared prime with probability 1

[issue40532] Persmission error

2020-05-06 Thread Steven D'Aprano
Steven D'Aprano added the comment: What reason do you have to think that this is a Python issue rather than a permissions error? Since you haven't told us what permissions the file has, what OS you are using, who set the permissions, or even the actual error message, it is imp

[issue40529] Auto Completions with case insensitive

2020-05-06 Thread Steven D'Aprano
Steven D'Aprano added the comment: Python is a case-sensitive language. Why would case-insensitive completions be useful? -- nosy: +steven.daprano ___ Python tracker <https://bugs.python.org/is

[issue40529] Auto Completions with case insensitive

2020-05-06 Thread Steven D'Aprano
Steven D'Aprano added the comment: This is a new feature, so it would have to go into 3.9, all older versions are in feature-freeze. -- versions: -Python 3.5, Python 3.6, Python 3.7, Python 3.8 ___ Python tracker <https://bugs.py

[issue40578] Deprecate numeric item access for platform.uname()

2020-05-09 Thread Steven D'Aprano
Steven D'Aprano added the comment: You have given no justification for removing item access for the fields except "some users are still relying on ... access by item position and length". Normally the fact that some people are doing this would be reason to reject

[issue40603] slice not hashable

2020-05-11 Thread Steven D'Aprano
Steven D'Aprano added the comment: Please re-upload the patch file as an uncompressed text file, as it is quite difficult for many people to view zip files in their browser. -- nosy: +steven.daprano title: slice does not slice -> slice not

[issue40603] slice not hashable

2020-05-11 Thread Steven D'Aprano
Change by Steven D'Aprano : -- components: +Interpreter Core -ctypes type: behavior -> enhancement ___ Python tracker <https://bugs.python.org

[issue40331] Increase test coverage for the statistics module

2020-05-13 Thread Steven D'Aprano
Steven D'Aprano added the comment: *blink* How did I miss this entire thing? Where was the code review? Thanks Tal for shepherding this through, and thanks Tzanetos for caring about the unit tests. -- ___ Python tracker <https://bugs.py

[issue40331] Increase test coverage for the statistics module

2020-05-13 Thread Steven D'Aprano
Steven D'Aprano added the comment: > Perhaps you missed it because you're not in the CODEOWNERS so don't > automatically get notified by GitHub? That's quite possible. I can't fix that as Github considers everything to do with my computer and browser too old.

[issue40639] Strange behavior in changing nested dictionaries

2020-05-15 Thread Steven D'Aprano
Steven D'Aprano added the comment: Hi Jacob, and welcome. You said: "I was experimenting with nested dictionaries when I came across strange behavior that I can not figure out at all." This is a bug tracker, for reporting bugs, not a help desk for asking how to figu

[issue42482] TracebackException should not hold reference to the exception traceback

2020-11-27 Thread Steven D'Aprano
Steven D'Aprano added the comment: This would be a change of behaviour, and 3.8 and 3.9 are in feature freeze, so we could only add it in 3.10. You say: "it's supposed to capture the output without holding references to real things" Is this requirement documented some

[issue42482] TracebackException should not hold reference to the exception traceback

2020-11-27 Thread Steven D'Aprano
Steven D'Aprano added the comment: Re-adding older versions. -- versions: +Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/is

[issue42488] Mathematical error

2020-11-28 Thread Steven D'Aprano
Steven D'Aprano added the comment: The ^ operator is bitwise-xor (exclusive-or), not exponentiation. Stop wasting our time by posting false bug reports. This is now your fifth incorrect bug report in a row. Once or twice can be forgiven that you didn't know better. Please stop

[issue42490] Business Logical Error

2020-11-28 Thread Steven D'Aprano
Steven D'Aprano added the comment: Nishant Gautam does not understand not condition. This is your sixth incorrect bug report in a row. Please stop. This is not a help desk to correct your mistakes. a == 10 and (b != (not(11))) and b == a --> True and (b != False) and True --> Tr

[issue42494] struct.unpack_from return 2 values instead of one

2020-11-28 Thread Steven D'Aprano
Steven D'Aprano added the comment: Hi Sébastien, This is a bug tracker for reporting bugs, not a help desk to help with your code. There are many community resources to help you debug your code, but this is not one of them. You can try: * Reddit's /r/learnpython * the Python-li

[issue42497] New pathlib.Path attribute

2020-11-29 Thread Steven D'Aprano
Steven D'Aprano added the comment: As a new feature, this could only go into 3.10, 3.9 is in feature freeze. The requirements are unclear, it could mean any of: - the file's *owner* has the execute bit set; - the file's mode has any execute bit set; - the *current us

[issue42546] copy - Allow .copy(deep=True) alongside .deepcopy() for easier usage and zen

2020-12-02 Thread Steven D'Aprano
Steven D'Aprano added the comment: This would be a classic example of the "Flag argument" anti-pattern: https://www.martinfowler.com/bliki/FlagArgument.html -- nosy: +steven.daprano ___ Python tracker <https://bugs.pyt

[issue42570] Try and Except doesn't work properly

2020-12-04 Thread Steven D'Aprano
Steven D'Aprano added the comment: Code is working correctly, not a bug. Perhaps you are mistaking `continue` for `break`. Kshitish, we keep telling you not to use the bug tracker as a help desk. This is now your eighth "bug report" that was 100% your misunderstanding. There

[issue42575] Suggest to add an LinkedList data structure to python

2020-12-05 Thread Steven D'Aprano
Steven D'Aprano added the comment: The class you have provided is awkward to use, random access is inefficient, it is not compatible with lists or offer a sequence API, it's not subscriptable or iterable, the API exposes an unnecessary "Proxy" class, and the API is mor

[issue42578] Add tip when encountering UnicodeDecode/EncodeError in open()

2020-12-05 Thread Steven D'Aprano
Steven D'Aprano added the comment: "Maybe a helpful tip can be added to the error message." What sort of helpful tip do you have in mind? Remember that the error doesn't occur when the file is opened, but some time later. -- n

[issue42614] Pathlib does not support a Cyrillic character 'й'

2020-12-10 Thread Steven D'Aprano
Steven D'Aprano added the comment: You are comparing the name with the file extension against the name without the file extension: >>> "Файл на български.ldr" == "Файл на български" False -- nosy: +steven.daprano

[issue42614] Pathlib does not support a Cyrillic character 'й'

2020-12-10 Thread Steven D'Aprano
Steven D'Aprano added the comment: In addition, you are probably hitting normalization issues. There are two ways to get the Cyrillic character 'й' in your string, one of them is a single code point, the other is two code points: >>> a = 'й' >>>

[issue42623] Syntax Error showing pointer in wrong location

2020-12-11 Thread Steven D'Aprano
Steven D'Aprano added the comment: The position of the caret assumes that every character in the string takes up the same width, measured in pixels. That is only true for monospaced fonts like Courier. The only way to position the caret precisely with a proportional-width font i

[issue42623] Syntax Error showing pointer in wrong location

2020-12-12 Thread Steven D'Aprano
Steven D'Aprano added the comment: > @ Steven, did you mean to un-nosy Pratik? No. I have tried to re-add him, but I think that because his user name is all digits, the bug tracker won't accept it. When I try, I get this error: Edit Error: user has no

[issue42654] Add folder for python customizations: __sitecustomize__

2020-12-16 Thread Steven D'Aprano
Steven D'Aprano added the comment: Shouldn't this be discussed on Python-Ideas? I'm pretty sure this is a big enough change that it will need a PEP. If you need code run on startup, can't you just put it in the PYTHONSTARTUP file? -- n

[issue42656] prime numbers loop issue

2020-12-16 Thread Steven D'Aprano
Steven D'Aprano added the comment: Hello valeriymartsyshyn, This is for reporting bugs in the Python interpreter, it is not a help desk for learning how to program in Python. There are many places you can ask for help to debug your code, such as Reddit's r/learnpython, or Stackov

[issue42654] Add folder for python customizations: __sitecustomize__

2020-12-16 Thread Steven D'Aprano
Steven D'Aprano added the comment: > Additionally, it suffers from the same issue as > sitecustomize. It is a single file that won't be a real substitute for > code execution in pth files. I thought that the consensus in b.p.o. #33944 is that code execution in pth files

[issue42641] Deprecate os.popen() function

2020-12-16 Thread Steven D'Aprano
Steven D'Aprano added the comment: > There is also the os.system() function which exposes the libc system() > function. Should we deprecate this one as well? Please don't deprecate os.system. For quick and dirty scripts used in trusted environments with trusted data, it

[issue23522] Misleading note in Statistics module documentation

2020-12-18 Thread Steven D'Aprano
Steven D'Aprano added the comment: I strongly oppose this change, and I dispute the characterisation of this as a misleading note. It is not misleading, and I argue that every word of it is factually correct. Jake, if you disagree, then please provide some citations. Irit: it is ridic

[issue42680] unicode identifiers not accessible or assignable through globals()

2020-12-18 Thread Steven D'Aprano
Steven D'Aprano added the comment: I'm pretty sure this is not a bug, but is working as designed. The interpreter normalises unicode identifiers, but key lookup in the dict does not. Sorry, I don't have time right now to give a more detailed answer, but there are two distinc

[issue23522] Misleading note in Statistics module documentation

2020-12-18 Thread Steven D'Aprano
Steven D'Aprano added the comment: I'm willing to give Irit and Jake opportunity to make their case. Particularly if they can demonstrate that I got my facts wrong. I'm going to close the ticket, but if anyone feels strongly enough to respond with a good argument, or better

[issue23522] Misleading note in Statistics module documentation

2020-12-18 Thread Steven D'Aprano
Change by Steven D'Aprano : -- resolution: -> rejected stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.pyth

[issue23522] Misleading note in Statistics module documentation

2020-12-19 Thread Steven D'Aprano
Steven D'Aprano added the comment: Sorry Raymond, I missed this before closing the task. > FWIW, Allen Downey also had concerns about this wording. I don't recognise the name, who is Allen Downey and what concerns does he have? -- _

[issue42686] include built-in Math functions in SQLite to 3.35.0 of march 2021

2020-12-19 Thread Steven D'Aprano
Steven D'Aprano added the comment: As far as I can tell, every one of those are already available in Python. https://docs.python.org/3/library/math.html -- nosy: +steven.daprano ___ Python tracker <https://bugs.python.org/is

[issue30480] samefile and sameopenfile fail for WebDAV mapped drives

2020-12-19 Thread Steven Geerts
Steven Geerts added the comment: still an issue with Python 3.8 and 3.9. A copy between 2 files on webdave mapped drives can't be done, although src and dst are different. -- nosy: +steven.geerts versions: +Python 3.8, Python 3.9 ___ P

[issue42699] Use `.join(k for k in g)` instead of `.join([k for k in g])`

2020-12-20 Thread Steven D'Aprano
Steven D'Aprano added the comment: By the way, it is almost always wrong to write "k for k in iterable" when you can just write "iterable" or "list(iterable)". Here are some micro-benchmarks: [steve ~]$ python3.9 -m timeit -s "from string im

[issue42686] include built-in Math functions in SQLite to 3.35.0 of march 2021

2020-12-21 Thread Steven D'Aprano
Steven D'Aprano added the comment: It is probably harmless to enable the option, especially if it will be the SQLite default, but why would you do your maths computations in sql, using the limited set of functions available, when you could do them in Python, with a much larger s

[issue42699] Use `.join(k for k in g)` instead of `.join([k for k in g])`

2020-12-21 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Mon, Dec 21, 2020 at 09:11:48PM +, Samuel Marks wrote: > There were only 12k occurrences, I'm sure I could manually go through that > in an afternoon. Would you accept it then? Assuming "an afternoon" is half a work d

[issue42723] Unclear why dict unpacking cannot be used in dict comprehension

2020-12-23 Thread Steven D'Aprano
Steven D'Aprano added the comment: They don't do the same thing. The dict comprehension requires a single key:value pair per loop. It accumulates values into a single dict. Try this: d = {} for key, value in items: print(id(d)) d[key] = value The ID does

[issue38308] Add optional weighting to statistics.harmonic_mean()

2020-12-23 Thread Steven D'Aprano
Steven D'Aprano added the comment: I like the addition but I'm not sure why you removed the price-earnings ratio example from the docs. I think that it's useful to have an example that shows that harmonic mean is not *just* for speed-related problems. I'm not going t

[issue38308] Add optional weighting to statistics.harmonic_mean()

2020-12-23 Thread Steven D'Aprano
Steven D'Aprano added the comment: Okay, I'm satisfied with that reasoning, thanks Raymond. Patch looks good to me. Go for it! Have a good Christmas and stay safe. -- ___ Python tracker <https://bugs.python.o

[issue42733] [issue] io's r+ mode truncate(0)

2020-12-25 Thread Steven D'Aprano
Steven D'Aprano added the comment: You say: > after process python3 test_case.py > json file's content like this > > @@{"how_dare_you": "how_dare_you"} I cannot replicate that result. I created a "data.json" with the followi

[issue42733] [issue] io's r+ mode truncate(0)

2020-12-25 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Fri, Dec 25, 2020 at 01:31:51PM +, 施文峰 wrote: > first test have a problem,you didn’t use r+ mode I did, I copied your `test()` function exactly, however I did make a mistake. I tried again with this: >>> with open(FILE_PATH, 'r

[issue42733] io's r+ mode truncate(0)

2020-12-25 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Sat, Dec 26, 2020 at 02:19:55AM +, Terry J. Reedy wrote: > "Enhancements" (non-bugfix feature changes) can only be applied to > future versions. However, you are asking for the reversion of an > intentional feature change ma

[issue42751] Imaplib

2020-12-26 Thread Steven D'Aprano
Steven D'Aprano added the comment: Are you the owner of imaplib2? If so, you need to ensure that there are no licencing or copyright issues preventing imaplib2 being transferred into the stdlib. That may (or may not) require you to get agreement from any contributors to the library.

[issue42765] Introduce new data model method __iter_items__

2020-12-28 Thread Steven D'Aprano
Steven D'Aprano added the comment: Hi Richard, > Also, using _asdict() seems strange as an exposed API, since it's an > underscore method and users hence might not be inclined to use it. I don't consider this a strong argument. Named tuple in general has to use a

[issue42776] The string find method shows the problem

2020-12-28 Thread Steven D'Aprano
Steven D'Aprano added the comment: # True data.find('a', 0) That will return 0, not True. # False data.find('a', start=0) And that will raise TypeError, not return False. What exactly are you reporting here? I have read your bug report, and looked at the screen

[issue42779] Pow compute can only available in python3.7

2020-12-29 Thread Steven D'Aprano
Steven D'Aprano added the comment: What error are you getting? Can you demonstrate the error without gmpy2, as that is a third-party library and nothing to do with us. -- nosy: +steven.daprano ___ Python tracker <https://bugs.py

[issue42779] Pow compute can only available in python3.7

2020-12-29 Thread Steven D'Aprano
Steven D'Aprano added the comment: I cannot replicate that. On my computer, I can compute pow(c, e) in approximately two minutes using Python 3.9: >>> from time import time >>> t = time(); a = pow(c, e); time()-t 122.07566785812378 >>> math.log10(a) 50473

[issue42779] pow() of huge input does not complete

2020-12-29 Thread Steven D'Aprano
Change by Steven D'Aprano : -- components: +Interpreter Core -C API title: Pow compute can only available in python3.7 -> pow() of huge input does not complete versions: +Python 3.6, Python 3.9 -Python 3.7 ___ Python tracker

[issue42797] Allow doctest to select tests via -m/--match option

2020-12-31 Thread Steven D'Aprano
Steven D'Aprano added the comment: I think that -m is unacceptable as it will clash with Python's -m option. I'm not convinced that this added complexity will provide enough benefit to make it worth while. I can see myself spending an order of magnitude more time trying to

[issue42801] Exception catching function crashes on recursive list

2020-12-31 Thread Steven D'Aprano
New submission from Steven D'Aprano : This function crashes on the following recursive list: def length(x): try: return sum(length(i) for i in x) except Exception: return 1 a = [[1, 2, 3], [4, 5, 6]] a.append(a) length(a) Crashes: Fatal Python

[issue42816] Add str.split_iter function

2021-01-03 Thread Steven D'Aprano
Steven D'Aprano added the comment: I am pretty sure this has been discussed and rejected on the Python-Ideas mailing list before. If not rejected, the idea didn't go very far. You may wish to search the mailing list archives for previous discussions. Either way, I think this

[issue42816] Add str.split_iter function

2021-01-03 Thread Steven D'Aprano
Steven D'Aprano added the comment: See also discussion here: #17343 -- ___ Python tracker <https://bugs.python.org/issue42816> ___ ___ Python-bugs-list m

<    2   3   4   5   6   7   8   9   10   11   >