[issue42828] Python readline module

2021-01-05 Thread Steven D'Aprano
Steven D'Aprano added the comment: > when you import readline, at the end of program, the console remains unusable I cannot replicate that. I've been using readline in versions of Python starting from 2.4 to 3.9 and it has not left the console in an unusual state. Can you give

[issue42852] pprint fails in transformming non-breaking space

2021-01-07 Thread Steven D'Aprano
Steven D'Aprano added the comment: By the way, there is no need to use the u'' prefix on strings in Python 3. Unfortunately, I think this is a case where pprint doesn't meet your expectations. pprint is designed to print the repr of a string, while regular print prints t

[issue42885] Regex performance problem with ^ aka AT_BEGINNING

2021-01-11 Thread Steven D'Aprano
Steven D'Aprano added the comment: I'm getting similar results in Python 3.9. [steve ~]$ python3.9 -m timeit -s "a = 'A'*1" -s "import re" "re.search('^x', a)" 5000 loops, best of 5: 67.3 usec per loop [steve ~]$ python3.9 -m t

[issue42886] math.log and math.log10 domain error on very large Fractions

2021-01-11 Thread Steven D'Aprano
Steven D'Aprano added the comment: Guido wrote: > it would require the math.log function to recognize rationals I don't think it would. You don't need a type-check, you just need to check for a pair of numerator and denominator attributes. So we could do something like

[issue42895] Return multi-line list concatenation without parentheses returns only first operand

2021-01-11 Thread Steven D'Aprano
Steven D'Aprano added the comment: As Guido says, a full explanation will have to to a user-forum such as https://discuss.python.org/c/users/7 but consider this example and see if it gives you insight: def demo(): x = 1 return ( x - 1 ) print("T

[issue42885] Optimize re.search() for \A (and maybe ^)

2021-01-16 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Sat, Jan 16, 2021 at 08:59:13AM +, Serhiy Storchaka wrote: > > Serhiy Storchaka added the comment: > > ^ matches not just the beginning of the string. It matches the > beginning of a line, i.e. an anchor just after '\n'

[issue42954] new "if-as" syntax

2021-01-18 Thread Steven D'Aprano
Steven D'Aprano added the comment: Use the walrus operator: if profile := users.get(uid, None) is not None: print(f"user: {profile['name']}") -- nosy: +steven.daprano resolution: -> rejected stage: ->

[issue42954] new "if-as" syntax

2021-01-18 Thread Steven D'Aprano
Steven D'Aprano added the comment: Oops sorry I got the operator precedence wrong: if (profile := users.get(uid, None)) is not None: The walrus operator was added in Python 3.8. Using the "as" key word was considered and rejected. See the PEP: https://www.python.org/de

[issue42954] new "if-as" syntax

2021-01-18 Thread Steven D'Aprano
Steven D'Aprano added the comment: I'm not having a good day :-( > the process to get new syntax added to the library The process to get new syntax added to the **language**. -- ___ Python tracker <https://bugs.pytho

[issue42956] Easy conversion between range and slice

2021-01-18 Thread Steven D'Aprano
Steven D'Aprano added the comment: All versions older than 3.10 are in feature freeze and cannot get new features or enhancements, only bugfixes. Slices are far more general than range objects. How do you propose to deal with slice objects such as this? slice('item&#x

[issue43002] Exception chaining accepts exception classes

2021-01-22 Thread Steven D'Aprano
Steven D'Aprano added the comment: It is intended behaviour. `raise ... from` is a general mechanism that you can call anywhere, it is not just limited to raising from the previous exception. It is designed for explicitly setting the chained exception to some arbitrary exception. Se

[issue43002] Exception chaining accepts exception classes

2021-01-23 Thread Steven D'Aprano
Steven D'Aprano added the comment: How do you "the wrong message" to implicitly chain exceptions rather than explicitly? The difference between: try: len(1) except TypeError as e: raise ValueError(msg) from e and try: len(1) e

[issue43014] tokenize spends a lot of time in `re.compile(...)`

2021-01-24 Thread Steven D'Aprano
Steven D'Aprano added the comment: Just for the record: > The optimization takes the execution from ~6300ms to ~4500ms on my machine > (representing a 28% - 39% improvement depending on how you calculate it) The correct answer is 28%, which uses the initial value as the base:

[issue43021] Unpacking tuple argument in combination with inline if statement

2021-01-25 Thread Steven D'Aprano
Steven D'Aprano added the comment: This is a operation precedence issue. The line: t0, t1 = t if t is not None else [], [] is parsed as: (t if t is not None else []), [] so you need brackets around the "else" operand to get the effect you want. t0, t1 = t i

[issue43020] str.lower method with "İ" character

2021-01-25 Thread Steven D'Aprano
Steven D'Aprano added the comment: This is not a bug, but an issue with the way the Unicode standard defines the lowercase of dotted I. See #34723 Fortunately, Unicode will (hopefully!) fix this in revision 14.0, which is scheduled to be included in Python 3.10. Until then, perhap

[issue43025] Use normal 'i

2021-01-25 Thread Steven D'Aprano
Steven D'Aprano added the comment: https://mathworld.wolfram.com/j.html D and SmartBASIC use a literal suffix "i" for imaginary numbers. I can't find any other languages which support literal syntax for complex numbers, but I haven't looked very far. https://www

[issue43025] Use normal 'i' character to denote imaginary part of complex numbers

2021-01-25 Thread Steven D'Aprano
Steven D'Aprano added the comment: I think it always helps to look at what other languages do. It doesn't mean that we must follow them, but it may help us decide that the choice made in Python 1 was a mistake and it is worth going through the pain of deprecation, or that i

[issue43015] Add str.replaceall?

2021-01-25 Thread Steven D'Aprano
Steven D'Aprano added the comment: Versions 3.6-3.9 are all in feature-freeze, so the earliest this could be added is version 3.10. -- nosy: +steven.daprano versions: -Python 3.6, Python 3.7, Python 3.8, Python 3.9 ___ Python tracker &

[issue43070] Control keys stop working after pressing Ctrl-C Escape Enter

2021-01-29 Thread Steven D'Aprano
Steven D'Aprano added the comment: Ctrl-C is a red-herring here. Esc-Enter alone is sufficient to switch control processing. Tested in Python 2.7 and 3.9 using xfce4-terminal in Fedora: 1. Ctrl-L clears the terminal window; 2. Type Esc-Enter; 3. Ctrl-L now inserts an actual ^L (c

[issue43076] str.split() indexing issue

2021-01-30 Thread Steven D'Aprano
Steven D'Aprano added the comment: Hi Aleksandr, In future, when posting what you think might be a bug, please try to cut the code down to the bare minimum needed. In this case, it doesn't matter at all that the strings you are processing come from splitting a larger string. s

[issue43076] str.split() indexing issue

2021-01-30 Thread Steven D'Aprano
Steven D'Aprano added the comment: Slicing is described here: https://docs.python.org/3/tutorial/introduction.html -- ___ Python tracker <https://bugs.python.org/is

[issue43150] Last empty string not removed in a list

2021-02-06 Thread Steven D'Aprano
Steven D'Aprano added the comment: This is not a language bug, it is a bug in your code: you are modifying the list as you iterate over it. There are lots of ways to do that task correctly, perhaps the easiest is with a filter: str_list = list(filter(bool, str_list)) or a

[issue43150] Last empty string not removed in a list

2021-02-06 Thread Steven D'Aprano
Steven D'Aprano added the comment: The problem here is that you are shortening the list as you walk along it, which means you skip items. You expected to visit: "Emma", "Jon", "", "Kelly","Eric", "", "", "

[issue43151] is with literals in 3.8 release

2021-02-06 Thread Steven D'Aprano
Steven D'Aprano added the comment: Gary, I cannot replicate that inconsistency in 3.9.0. >>> x = "abc" >>> x is "abc" :1: SyntaxWarning: "is" with a literal. Did you mean "=="? True >>> if x is "abc": pass ...

[issue43157] Bug in methods of creating the 2d list

2021-02-07 Thread Steven D'Aprano
Steven D'Aprano added the comment: This is not a bug, it is working correctly, as designed. List multiplication does not *copy* the list, it replicates the reference to the same list object. So [[0]]*5 does not make five different sublists, but the same list repeated five times. Exactl

[issue43157] Bug in methods of creating the 2d list

2021-02-07 Thread Steven D'Aprano
Steven D'Aprano added the comment: There is also an FAQ about this: https://docs.python.org/3/faq/programming.html#how-do-i-create-a-multidimensional-list See also: https://docs.python.org/3/faq/programming.html#why-did-changing-list-y-also-change-list-x By the way, for future bug re

[issue43151] is with literals in 3.8 release

2021-02-07 Thread Steven D'Aprano
Steven D'Aprano added the comment: Terry, this may be an IDLE issue, can you confirm whether or not the difference in behaviour is intentional? -- nosy: +terry.reedy resolution: not a bug -> stage: resolved -> status: closed -> open

[issue43211] Python is not responding after running program

2021-02-12 Thread Steven D'Aprano
Steven D'Aprano added the comment: Hi Diasy, welcome! Please don't post screen shots of code. That makes it difficult or impossible for the blind and visually impaired to contribute, and it means that we have to retype your code from scratch to run it, which may introduce

[issue43221] German Text Conversion Using Upper() and Lower()

2021-02-13 Thread Steven D'Aprano
Steven D'Aprano added the comment: >>> '\N{LATIN SMALL LETTER SHARP S}' 'ß' >>> '\N{LATIN CAPITAL LETTER SHARP S}' 'ẞ' The history of ß is complicated and differs in the Germany speaking countries of Austria, Switzerland and Ger

[issue43280] additional argument for str.join()

2021-02-20 Thread Steven D'Aprano
Steven D'Aprano added the comment: Python 3.9 is in feature freeze, this couldn't be added before 3.10 now. You have: ", ".join(["a", "b", "c"], ", and ") outputing this: "a, b, and, c" So what are the sem

[issue43280] additional argument for str.join()

2021-02-20 Thread Steven D'Aprano
Steven D'Aprano added the comment: Looking more closely, I think that the semantics are to concatenate the extra argument to the second-last item: ", ".join(["a", "b", "c"]) # -> "a, b, c" ", ".join(["a&

[issue43280] additional argument for str.join()

2021-02-20 Thread Steven D'Aprano
Change by Steven D'Aprano : -- resolution: -> rejected stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.pyth

[issue43315] Decimal.__str__ has no way to force exact decimal representation

2021-02-24 Thread Steven D'Aprano
Steven D'Aprano added the comment: Python 3.5 to 3.9 are all in feature freeze and can accept no new features; new features can only be added to 3.10. But having said that, I agree with Mark that the correct solution here is to use format, not str. Szymon, unless you have a very arg

[issue43380] Assigning function parameter to class attribute by the same name

2021-03-03 Thread Steven D'Aprano
Steven D'Aprano added the comment: Here's an example that shows what is going on: def demo(): a = 1 class B: x = a print(B.x) # Okay. class C: x = a # Fails. if False: a = None print(C.x) If you run that, B.x is print

[issue43380] Assigning function parameter to class attribute by the same name

2021-03-03 Thread Steven D'Aprano
Steven D'Aprano added the comment: Looking at the disassembly of the demo() function also shows differences between the B and C classes. I seem to recall discussion about this on, maybe, the Python-Dev list. I think resolving this will probably have to wait on a re-design of the

[issue43385] heapq fails to sort tuples by datetime correctly

2021-03-03 Thread Steven D'Aprano
Steven D'Aprano added the comment: Heaps are not sorted lists! It is true that a sorted list is a heap, but heaps are not necessarily sorted. Here is another heap which is not sorted: >>> L = [] >>> for n in (9, 7, 8, 11, 4): ... heapq.heappush(L, n) ... >>

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

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

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

[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> ___ ___ Pytho

[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> ___ ___ Pytho

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

[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> ___ ___ Pytho

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

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

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

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

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

[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

[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&#

[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()<&

[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

[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

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

2020-06-14 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 on

[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

[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

[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

[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&quo

[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

[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, o

[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

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

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

[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

[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

[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

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

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

[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

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

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

[issue41495] Technical advise

2020-08-06 Thread Steven D'Aprano
Change by Steven D'Aprano : -- Removed message: https://bugs.python.org/msg374932 ___ Python tracker <https://bugs.python.org/issue41495> ___ ___ Pytho

[issue41495] SPAM

2020-08-06 Thread Steven D'Aprano
Change by Steven D'Aprano : -- resolution: -> not a bug stage: -> resolved status: open -> closed title: Technical advise -> SPAM ___ Python tracker <https://bugs.p

[issue41518] incorrect printing behavior with parenthesis symbols

2020-08-10 Thread Steven D'Aprano
Steven D'Aprano added the comment: Python 3.6 has reached security-fix only stage: https://www.python.org/dev/peps/pep-0494/#schedule-last-bugfix-release so even if this is a bug, it won't be fixed in 3.6. I cannot reproduce this in 3.7, and Eric cannot reproduce in 3.6.9, so I&

[issue41517] Able to subclass enum with members by using multiple inheritance

2020-08-10 Thread Steven D'Aprano
Steven D'Aprano added the comment: The documentation says: "Allowing subclassing of enums that define members would lead to a violation of some important invariants of types and instances." but it isn't clear what those invariants are, or why it is more of a problem

[issue41518] incorrect printing behavior with parenthesis symbols

2020-08-11 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Tue, Aug 11, 2020 at 07:16:20AM +, Ramesh Sahoo wrote: > for i in stack: > print("inside if Popped =",stack.pop(stack.index(i))) You are mutating the list while you iterate over it. This is prone to cause trouble. Her

[issue41542] module `__all__` cannot detect function name with `φ`

2020-08-13 Thread Steven D'Aprano
Steven D'Aprano added the comment: Hi Seth, Surely you aren't relying on the behaviour that names in `__all__` *aren't* normalised but others are? Rather than a warning, I think the right solution here is to normalise the names in `__all__`. -- nosy:

[issue41545] gc API requiring matching number of gc.disable - gc.enable calls

2020-08-13 Thread Steven D'Aprano
Steven D'Aprano added the comment: > I wrap a function's logic with `gc.disable()` to prevent GC from triggering > some race condition. If this race condition is a bug in gc, then we should fix that. If it is a bug in your code, surely you should fix that rather than disable

[issue41542] module `__all__` cannot detect function name with `φ`

2020-08-14 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Fri, Aug 14, 2020 at 02:03:37PM +, Seth Woodworth wrote: > I'm exploring what unicode code points can be used as valid starting > characters for identifiers. I presume you have seen the documention here: https://docs.python

[issue41558] Backspace not clearing the text

2020-08-15 Thread Steven D'Aprano
Steven D'Aprano added the comment: Works correctly for me in the Python interpreter. Please check if it works for you in the Python interpreter, if it does, then it is a bug in Jupyter and should be reported to them, we cannot do anything to fix it. -- nosy: +steven.da

[issue41563] .python_history file causes considerable slowdown

2020-08-17 Thread Steven D'Aprano
Steven D'Aprano added the comment: How very odd. I use the Python interactive interpreter extensively, and have done so for years. My history file is only 500 lines. Did you happen to inspect the file before deleting it to see if it contained something odd? What does this print fo

[issue41563] .python_history file causes considerable slowdown

2020-08-17 Thread Steven D'Aprano
Steven D'Aprano added the comment: > My history file is only 500 lines. *slaps forehead* Of course it is, I'm running a customer history hook that has a limit of 500 lines in the history file. It looks to me that by default the history feature is set to unlimited lines, so

[issue41590] "zip()" very slowly for this

2020-08-19 Thread Steven D'Aprano
Steven D'Aprano added the comment: What are you actually reporting? What part of the documentation do you think should be changed, why should it be changed, and what should it be changed to? It is normal for different algorithms to perform with different speed. I'm not sure what t

[issue41590] "zip()" very slowly for this

2020-08-19 Thread Steven D'Aprano
Steven D'Aprano added the comment: If you know about timeit, why aren't you using it? In any case, I have just ran your nested_lists.py file, and on my computer, the last version with zip is the fastest version: 0 transpose1_0(lT) Time = 1.0627508163452149e-05 7 zip

[issue41598] rnd() + rndup() in math

2020-08-21 Thread Steven D'Aprano
Steven D'Aprano added the comment: Vedran: you are quoting von Neumann out of context, he was talking about generating random numbers, not rounding, and in the seven decades since he made his famous witticism, we of course know that there is absolutely nothing wrong with generating r

[issue41598] rnd() + rndup() in math

2020-08-21 Thread Steven D'Aprano
Steven D'Aprano added the comment: Marco, it is better to give a description of the functionality required rather than a simplistic and incorrect implementation :-) (Not that I am likely to provide a better implementation without a lot of study.) Regardless of whether you or I agree

[issue41616] Global variable in whole project and Relative imports problem

2020-08-22 Thread Steven D'Aprano
Steven D'Aprano added the comment: One issue per ticket please. Versions 3.9 and older are all in feature freeze, they will not get new features. Combining a global declaration with an assignment has been requested before, and rejected. If you want to discuss that feature again, you s

[issue41598] Adding support for rounding modes to builtin round

2020-08-24 Thread Steven D'Aprano
Steven D'Aprano added the comment: Okay Marco, I'm changing the title to reflect the new API (support for rounding modes rather than new round functions) and pushed the version to 3.10, since 3.9 is in feature freeze (no new features). This will probably need to be discussed on Py

[issue41645] Typo First Page of Documentation

2020-08-26 Thread Steven D'Aprano
Steven D'Aprano added the comment: I don't think that Python, a computer language, IS an approach to OOP. A programming language HAS an approach to OOP. We would say "Python's approach to OOP is ..." so the approach is something that belongs to Python, it isn&#x

[issue41656] Sets are storing elements in sorted order.

2020-08-28 Thread Steven D'Aprano
Steven D'Aprano added the comment: "Unordered" means that the language doesn't promise any specific order, it doesn't mean that there is no order at all. Try strings: py> set("abcdef") {'b', 'f', 'c', 'e', &

[issue41656] Sets are storing elements in sorted order.

2020-08-28 Thread Steven D'Aprano
Steven D'Aprano added the comment: Here's another example: py> set([1, 2**63, 4, -5, 6, 5]) {1, 9223372036854775808, 4, 6, 5, -5} By the way, in the future, please don't post screen shots of text, copy the code and output and paste it as text into your bug report. S

[issue41666] fix

2020-08-30 Thread Steven D'Aprano
Steven D'Aprano added the comment: I agree with xtreak. I guess you probably misspelled the initial word: >>> 'Python'[2:5] # same as the tutorial 'tho' >>> 'Pyhton'[2:5] # misspelling 'hto' -- nosy: +steven.daprano

[issue41716] SyntaxError: EOL while scanning string literal

2020-09-04 Thread Steven D'Aprano
Steven D'Aprano added the comment: You can't end a string with a bare backslash, not even an raw string. -- nosy: +steven.daprano resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker <h

[issue41716] SyntaxError: EOL while scanning string literal

2020-09-04 Thread Steven D'Aprano
Steven D'Aprano added the comment: See the FAQ: https://docs.python.org/3/faq/design.html#why-can-t-raw-strings-r-strings-end-with-a-backslash Also documented here: https://docs.python.org/dev/reference/lexical_analysis.html#string-and-bytes-literals Previous issues: #1271 and #

[issue41719] Why does not range() support decimals?

2020-09-04 Thread Steven D'Aprano
Steven D'Aprano added the comment: Generating a range of equally-spaced floats is tricky and the range builtin is not the right solution for this. For numerical work, we often need to specify the number of steps, not the step size. For instance, in numeric integration, we often li

[issue41740] Improve error message for string concatenation via `sum`

2020-09-07 Thread Steven D'Aprano
Steven D'Aprano added the comment: As Marco says, the exception message is because the default value for start is 0, and you can't concatenate strings to the integer 0. You get the same error if you try to concatenate lists: py> sum([[], []]) TypeError: unsupported o

[issue41740] Improve error message for string concatenation via `sum`

2020-09-07 Thread Steven D'Aprano
Steven D'Aprano added the comment: Marco, sum should be as fast as possible, so we don't want to type check every single element. But if it is easy enough, it might be worth checking the first element, and if it fails, report: cannot add 'type' to start value wher

[issue41743] Remove Unnecessarily Gendered Language from the Documentation

2020-09-08 Thread Steven D'Aprano
Steven D'Aprano added the comment: Hello David, I really don't think you speak for the entire LGBTQ community. You don't speak for me or my wife. You mention two issues here: "First is that break and continue don't allow the programmer to do anything, they cause

[issue41743] Remove Unnecessarily Gendered Language from the Documentation

2020-09-08 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Tue, Sep 08, 2020 at 06:23:58PM +, David Williams wrote: > Steven, it sounds like we agree to the change proposal, which is to > remove gendered language from the documentation. What? Did you even read w

[issue41770] Import module doesn't updated

2020-09-11 Thread Steven D'Aprano
Steven D'Aprano added the comment: This is not a bug, it is working as designed. Importing takes the module from the cache. You can either delete the module from the cache: del sys.modules['modulename'] import modulename # reloads from the module file or possib

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