[issue41481] pip install will install version 0.0.0 if existing in stead of newer ones

2020-08-04 Thread Steven D'Aprano
Steven D'Aprano added the comment: This is a bug tracker for issues with the Python language, interpreter and standard library. For third party applications like pip, please report bugs to their maintainers. https://github.com/pypa/pip/issues -- nosy: +steven.daprano resolution

[issue41479] pip install== will install 0.0.0 version in stead of showing alll

2020-08-04 Thread Steven D'Aprano
Steven D'Aprano added the comment: This is a bug tracker for issues with the Python language, interpreter and standard library. For third party applications like pip, please report bugs to their maintainers. https://github.com/pypa/pip/issues -- nosy: +steven.daprano resolution

[issue41407] Tricky behavior of builtin-function map

2020-07-27 Thread Steven D'Aprano
Steven D'Aprano added the comment: Converting *all* exceptions into RuntimeError is certainly not a good idea, especially since you include KeyboardInterrupt and other non-errors. I'm probably going to be on the losing side of this one (I lost the argument back when a similar issue

[issue41301] Assignment operation of list is not working as expected

2020-07-15 Thread Steven D'Aprano
New submission from Steven D'Aprano : Sorry Yashwanthbarad, this isn't a bug, you expect the wrong result. Augmented assignment for lists is documented to be the same as calling the extend method, which means your AppenedFuncShortHandOperator function modifies the argument list in-place

[issue41297] Remove doctest import from heapq

2020-07-14 Thread Steven D'Aprano
Steven D'Aprano added the comment: The idiom of a module running doctests on itself when executed as a script is a common idiom. If modulegraph and pyinstaller can't cope a module importing another module from inside an if statement, that's a bug in them, not in the heapq module (and many

[issue41276] Min / Max returns different values depending on parameter order

2020-07-10 Thread Steven D'Aprano
Steven D'Aprano added the comment: In your first example, `min([(-5, 2), (0, 2)])` the min() function compares the two tuples and finds that the first one is lexicographically smaller: py> (-5, 2) < (0, 2) True so (-5, 2) is considered the minimum. In the second example,

[issue41276] Min / Max returns different values depending on parameter order

2020-07-10 Thread Steven D'Aprano
Steven D'Aprano added the comment: This is correct behaviour. What makes you think otherwise? For future bug reports, please don't post screen shots of text, copy and paste the text into the body of your bug report. Posting screenshots makes it difficult for us to copy and run your code

[issue41274] Better way to random.seed()?

2020-07-10 Thread Steven D'Aprano
Steven D'Aprano added the comment: This is definitely cool though. It might make a really sweet example in the demos that come with Python, or in the tutorial, showcasing both the awesomeness of HelioViewer and how to use Python to connect to web APIs. https://github.com/python/cpython/tree

[issue41243] SPAM

2020-07-08 Thread Steven D'Aprano
Change by Steven D'Aprano : -- resolution: -> not a bug stage: -> resolved status: open -> closed title: Android Game -> SPAM type: security -> ___ Python tracker <https://bugs.pyt

[issue41240] Use the same kind of quotation mark in f-string

2020-07-08 Thread Steven D'Aprano
Steven D'Aprano added the comment: Just change the f string quotes. Python strings, whether f-strings or not, can be delimited by '' or "" or triple quotes. So this works: >>> f"But, {'this quote is right.'}" 'But, this quote is right.' Remember that the part

[issue41198] Round built-in function not shows zeros acording significant figures and calculates different numbers of odd and even

2020-07-02 Thread Steven D'Aprano
Steven D'Aprano added the comment: If you change the starting point of the rounding away from zero, the bias flips back and forth, which is exactly what I would expect from Banker's Rounding: def check_bias(start): d = 0.001 ne = no = 0 for i in range(1000

[issue41198] Round built-in function not shows zeros acording significant figures and calculates different numbers of odd and even

2020-07-02 Thread Steven D'Aprano
Steven D'Aprano added the comment: Thank you for your long and detailed bug report, but please post one issue per bug report. Tim, we agree that the notion of significant figures is irrelevant; is Carlos' even/odd test sufficiently flawed that we should close this bug report, or keep

[issue41166] CLASS ATTRIBUTES

2020-06-30 Thread Steven D'Aprano
Steven D'Aprano added the comment: By the way, for future reports, it is much better to give the URL of the page and copy and paste the exact quote than to give a screen shot. Using a screen shot is inconvenient for us (we have to try to guess what URL you are referring to, there are *lots

[issue41166] CLASS ATTRIBUTES

2020-06-30 Thread Steven D'Aprano
Steven D'Aprano added the comment: "Class attribute" and "instance attribute" are the usual terms used in the Python documentation and community. I have heard other terms used in other language communities, in particular "members" and "variables", b

[issue41071] from an int to a float , why

2020-06-22 Thread Steven D'Aprano
Steven D'Aprano added the comment: Mike, the bug tracker is not a help-desk for questions. There are many other forums where you can ask for help: - the python-list and tutor mailing lists https://www.python.org/community/lists/ - Stackoverflow - The Python IRC channel https

[issue41057] Division error

2020-06-20 Thread Steven D'Aprano
Steven D'Aprano added the comment: Further to what Mark said, I'm afraid you are mistaken when you thought that "the result was correct" on R. R cheats by not printing the full precision of the number, they just stop printing digits, giving a false impression of accuracy. You

[issue40981] increment is wrong in 3.7 but not in 2.7

2020-06-15 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Mon, Jun 15, 2020 at 07:37:16PM +, mike stern wrote: > sorry but I don't see the option to delete Your keyboard has a Delete key and a Backspace key. Select the quoted text in your email client and press one or the other. If you can't see the quo

[issue40981] increment is wrong in 3.7 but not in 2.7

2020-06-15 Thread Steven D'Aprano
Steven D'Aprano added the comment: > I wouldn't trust a language behaving crazy like this I guess then you won't trust C, Java, C++, Swift, Javascript, Ruby, Cobol, Fortran, and pretty much every programming language in existence. The only ones that escape this are ones that don't h

[issue40911] Unexpected behaviour for += assignment to list inside tuple

2020-06-08 Thread Steven D'Aprano
Steven D'Aprano added the comment: Alas, this gotcha is the consequence of the way `+=` is defined in Python. Although the behaviour is surprising, there's nothing to fix because everything is working as expected: * addition to a list will extend the list, as expected; * trying to assign

[issue40909] unittest assertCountEqual doesn't filter on values in dict

2020-06-08 Thread Steven D'Aprano
Steven D'Aprano added the comment: This is working as designed. assertCountEqual is documented here: https://docs.python.org/3/library/unittest.html#unittest.TestCase.assertCountEqual It says: "Test that sequence *first* contains the same elements as *second*..." notice that it t

[issue40879] Strange regex cycle

2020-06-05 Thread Steven D'Aprano
Steven D'Aprano added the comment: Wait, I'm sorry, do you mean this? py> repr(r)[13:-16] '?i)b((?:[a-z][w-]+:(?:/{1,3}|[a-z0-9%])|wwwd{0,3}[.]|[a-z0-9.-]+[.][a-z]{2,4}/)(?:[^s()<>]+|(([^s()<>]+|(([^s()<>]+)))*\\

[issue40879] Strange regex cycle

2020-06-05 Thread Steven D'Aprano
Steven D'Aprano added the comment: > notice the stripped characters in the `repr` Er, no. Your regex looks like line noise, and it hurts my brain to look at it :-) If you have spotted a difference, can you tell us what characters are stripped? When I try running it, I don't get

[issue40863] bytes.decode changes/destroys line endings on windows

2020-06-04 Thread Steven D'Aprano
Steven D'Aprano added the comment: You don't need `b = bytes([0x41, 0x0D, 0x0A])`, this will work just as well: b = b'\x41\x0D\x0A' and this is even better: b = b'A\r\n' > It seems like bytes.decode always replaces "\n" with "\r\n". What makes you sa

[issue40855] statistics.stdev ignore xbar argument

2020-06-03 Thread Steven D'Aprano
Steven D'Aprano added the comment: Thanks Raymond, that is the intended effect, and your analysis seems plausible. -- ___ Python tracker <https://bugs.python.org/issue40

[issue40809] list.Count() isn't working as expected for the series of same numbers in a list

2020-05-28 Thread Steven D'Aprano
Steven D'Aprano added the comment: Typo: "on each step, you delete one item from the from and step forward" Should be, you delete one item from the FRONT and step forward. -- ___ Python tracker <https://bugs.python.o

[issue40809] list.Count() isn't working as expected for the series of same numbers in a list

2020-05-28 Thread Steven D'Aprano
Steven D'Aprano added the comment: Rémi is correct, this is not a bug. The problem isn't with list.count. If you print list.count each time through the loop, you will see that it is working perfectly. The problem is that you are modifying the list as you are iterating over it. That means

[issue40762] Writing bytes using CSV module results in b prefixed strings

2020-05-26 Thread Steven D'Aprano
Steven D'Aprano added the comment: On further thought, no, I don't think it would be a reasonable feature. User opens the CSV file, probably using the default encoding (UTF-8?) but potentially in anything. They collect some data as bytes. Those bytes could be from any unknown encoding. When

[issue40762] Writing bytes using CSV module results in b prefixed strings

2020-05-26 Thread Steven D'Aprano
Steven D'Aprano added the comment: The csv file object knows the encoding it was opened with, I think? If so, we could add an enhancement that bytes objects are first decoded to str using the same encoding the file was opened with. That seems like a reasonable new feature to me. Everything

[issue40761] unittest.TestCase.asserTrue return True even if the expr is False

2020-05-24 Thread Steven D'Aprano
Steven D'Aprano added the comment: Works for me in 3.7. See attached file. Can you provide a minimal piece of code that demonstrates the bug? Since Python 3.5 is now only accepting security fixes, and numpy is a third-party library, unless you can demonstrate this in a more recent version I

[issue40761] unittest.TestCase.asserTrue return True even if the expr is False

2020-05-24 Thread Steven D'Aprano
Change by Steven D'Aprano : Added file: https://bugs.python.org/file49192/test_asserttrue.py ___ Python tracker <https://bugs.python.org/issue40761> ___ ___ Python-bug

[issue40761] unittest.TestCase.asserTrue return True even if the expr is False

2020-05-24 Thread Steven D'Aprano
Change by Steven D'Aprano : Removed file: https://bugs.python.org/file49191/test_asserttrue.py ___ Python tracker <https://bugs.python.org/issue40761> ___ ___ Python-bug

[issue40761] unittest.TestCase.asserTrue return True even if the expr is False

2020-05-24 Thread Steven D'Aprano
Change by Steven D'Aprano : -- Removed message: https://bugs.python.org/msg369846 ___ Python tracker <https://bugs.python.org/issue40761> ___ ___ Python-bug

[issue40761] unittest.TestCase.asserTrue return True even if the expr is False

2020-05-24 Thread Steven D'Aprano
Steven D'Aprano added the comment: Works for me in Python 3.7. See attached file. Given that Python 3.5 is only longer accepting security fixes, and that numpy is a third-party library, unless you can reproduce this in a more recent version I think we should close this. -- nosy

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

2020-05-22 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Fri, May 22, 2020 at 10:23:06AM +, Rémi Lapeyre wrote: > As you said the PEP would have to explain why not just use sympy and > honestly I don't have a very good argument there for now. Because sympy is a beast. It's an excellent beast, b

[issue40682] random.Random.seed() with version=1 does not consistently match Python 2 behavior

2020-05-19 Thread Steven D'Aprano
Steven D'Aprano added the comment: 3.5 and 3.6 are now only accepting security fixes. Only the stability of random.random is guaranteed across versions, but you are calling randrange: https://docs.python.org/3/library/random.html#notes-on-reproducibility So I am pretty sure

[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 figure ou

[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. Until I can get a new co

[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.python.

[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/issu

[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 hasha

[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 this

[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.python.

[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/issue40

[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 impossible

[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/16 byOpen

[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 whet

[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. Ca

[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.python.

[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 information

[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/issu

[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 the behaviour

[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/issue40

[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 CPython

[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 before 3.9

[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 expected

[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 doctest to either

[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:

[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 key is

[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 <https://bugs.p

[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 major advantages of Deci

[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

[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 get fr

[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.org/issue40

[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.org/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 = float('NaN')``, then ``x

[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 unde

[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.python.or

[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.python.org/issue40

[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. If your eyes

[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 3, they a

[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 demand i

[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 various other

[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 clear instead of more

[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/3/tutorial

[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/issue39

[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.python.or

[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 would

[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.python.or

[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, not 1

[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 > the second

[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__, func

[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 is a

[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 me whe

[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 100

[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 other is a fu

[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('1*10**9

[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 "[i

[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 consensus

[issue1207613] Idle Editor: Bottom Scroll Bar

2020-02-28 Thread Steven D'Aprano
Change by Steven D'Aprano : -- nosy: +steven.daprano ___ Python tracker <https://bugs.python.org/issue1207613> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue39774] Missing documentation on how to make package executable as script

2020-02-27 Thread Steven D'Aprano
Steven D'Aprano added the comment: You're right that it's hard to find any documentation on package `__main__.py` files. There's nothing here that I can see: https://docs.python.org/3/reference/import.html#packages Aside from the tutorial, the only other place I can find it referenced

[issue39749] python 3.8.1 (3.14 * 10 = 31.400000002 bug)

2020-02-25 Thread Steven D'Aprano
Steven D'Aprano added the comment: This behaviour is shared by all programming languages that use floating point numbers. For example, this is Ruby: [steve@ando ~]$ irb irb(main):001:0> 10 * 3.14 == 31.4 => false irb(main):002:0> 10 * 3.14 - 31.4 => 3.55271

[issue39738] mod operation with large number is not correct.

2020-02-24 Thread Steven D'Aprano
Steven D'Aprano added the comment: This is a floating point issue, not a bug. Floats inherently only have a limited precision available, so they are not always the exact number you think they are. Using 1e9 forces the result to be a float, which introduces rounding errors

[issue39641] concatenation of Tuples

2020-02-16 Thread Steven D'Aprano
Steven D'Aprano added the comment: [Bruce] > but try this, and it will NOT work: > > FatThing= [(5, 4, "First Place"), >(6, 6, "Fifer Place"), >(2, 2, "Slowr Place")] > print(FatThing) #this works > > FFThing

[issue39641] concatenation of Tuples

2020-02-15 Thread Steven D'Aprano
Steven D'Aprano added the comment: > The concatenation of two tuples into a third tuple, using the + command, > causes an error if every member of each of the two tuples is NOT a string! Works for me: py> ("Hello", 1, None) + (23, 19.5, "Goodbye")

[issue39637] Probably incorrect message after failed import

2020-02-15 Thread Steven D'Aprano
Steven D'Aprano added the comment: > Shouldn't that say that "'environ' is not a package" instead? No. The os module is special, so I'll talk about the usual case first. Normally, for `import spam.eggs` to succeed, *spam* has to be a package, and *eggs* has to be either a sub-

[issue39634] Add clarification in documentation for heapq.heapify naming

2020-02-14 Thread Steven D'Aprano
Change by Steven D'Aprano : -- nosy: +rhettinger ___ Python tracker <https://bugs.python.org/issue39634> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue39634] Add clarification in documentation for heapq.heapify naming

2020-02-14 Thread Steven D'Aprano
Change by Steven D'Aprano : -- assignee: -> docs@python components: +Documentation -Library (Lib) nosy: +docs@python title: Add clarification in documentation for incorrect heapq heapify naming -> Add clarification in documentation for heapq.heapify naming type: -> en

[issue39634] Incorrect heapq heapify naming

2020-02-14 Thread Steven D'Aprano
Steven D'Aprano added the comment: The "-ify" or "-fy" suffix in English means "to make". For example, "amplify", "magnify", "terrify", etc. https://en.wiktionary.org/wiki/-ify So heapify literally means "make int

[issue39574] str.__doc__ is misleading

2020-02-11 Thread Steven D'Aprano
Steven D'Aprano added the comment: Sorry everyone, due to technology problems I am unable to comment on the github page, and due to ISP problems I've been off the internet for a few days. > pull_request: https://github.com/python/cpython/pull/18401 [Serhiy] > Is not "or both&quo

[issue39607] Add a parameter to strip, lstrip, and rstrip that treats the first parameter as a full string

2020-02-11 Thread Steven D'Aprano
Steven D'Aprano added the comment: This has been discussed not long ago, it seems like it will need a PEP. See Brett's comment: https://mail.python.org/archives/list/python-...@python.org/message/BDK6BDBOG2462SJIIOC5QMYPAJ5A4523/ and various discussions: https://mail.python.org/archives

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