[issue47214] builtin_function_or_method is also either a function or a method

2022-04-04 Thread Steven D'Aprano
Steven D'Aprano added the comment: Perhaps what you want is inspect.isroutine ? https://docs.python.org/3/library/inspect.html#inspect.isroutine I agree with Dennis that the isfunction test is for **Python** (def or lambda) functions, not builtins. The docstring for the inspect.is* me

[issue45542] Using multiple comparison operators can cause performance issues

2022-04-04 Thread Steven D'Aprano
Steven D'Aprano added the comment: I came here from #47221. If I am reading this correctly, it concerns me that stack operations (which should be fast) are apparently slow? If we can't reduce the number of stack operations, can we speed them up? -- nosy: +steven.dapr

[issue47121] math.isfinite() can raise exception when called on a number

2022-04-05 Thread Steven D'Aprano
Steven D'Aprano added the comment: Isn't this just a quality of implementation issue? math.isfinite should return True for all ints, since all ints are finite. (There are no int infinities or NANs). There is no need to coerce them to float to know that they are finite. Li

[issue47234] PEP-484 "numeric tower" approach makes it hard/impossible to specify contracts in documentation

2022-04-06 Thread Steven D'Aprano
Change by Steven D'Aprano : -- nosy: +steven.daprano ___ Python tracker <https://bugs.python.org/issue47234> ___ ___ Python-bugs-list mailing list Unsubscr

[issue47136] The variable __module__ in the class body getting an undesirable value from __prepare__ of the metaclass

2022-04-07 Thread Steven D'Aprano
Steven D'Aprano added the comment: It would be nice if the class creation process was documented a bit better. Here is my experiment to see what is going on: ``` # the global `__name__` is normally the module's name. __name__ = "something" class Meta_default_prepare(ty

[issue47259] string sorting often incorrect

2022-04-08 Thread Steven D'Aprano
Change by Steven D'Aprano : -- nosy: +steven.daprano ___ Python tracker <https://bugs.python.org/issue47259> ___ ___ Python-bugs-list mailing list Unsubscr

[issue30413] Add fnmatch.filterfalse function

2019-08-21 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Wed, Aug 21, 2019 at 10:51:02AM +, STINNER Victor wrote: > Rather than adding a new function, why not adding a parameter like > sort(key=func, reverse=True)? Something like fnmatch.filterfalse(pat, > invert=True)? Guido argues tha

[issue37884] Optimize Fraction() and statistics.mean()

2019-08-25 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Sat, Aug 24, 2019 at 10:09:40AM +, Serhiy Storchaka wrote: > Could you please explain what is wrong in adding a helper function > which will help to convert different types of numbers to integer ratio > correctly? > > Currently

[issue37946] Add the Bessel functions of the first and second kind to the math module

2019-08-25 Thread Steven D'Aprano
Steven D'Aprano added the comment: If they are provided by the C lib, I would love to see them exposed by Python. If they aren't, I don't know if they should be treated as optional/platform dependent, or if we should provide an independent implementation. I guess the easy

[issue37988] Issue found during language name processing in a list

2019-08-30 Thread Steven D'Aprano
Steven D'Aprano added the comment: It may help if you read this: http://sscce.org/ It is written for Java programmers but it applies to Python as well. Don't expect us to re-type your code from a hard-to-read, out-of-focus, low-resolution photo of your monitor. Copy and paste the

[issue38001] Unexpected behaviour of 'is' operator

2019-09-01 Thread Steven D'Aprano
Steven D'Aprano added the comment: Further to Karthikeyan Singaravelan comment, the behaviour you see is absolutely correct. The operator isn't behaving differently, it is reporting precisely the truth. The ``is`` operator tests for object identity, not equality. Python makes no

[issue38048] unususal behavior

2019-09-07 Thread Steven D'Aprano
Steven D'Aprano added the comment: Hi Gaurav, It is very unlikely that you have "discovered a bug in Python". Millions of people use Python every day, and the chances that you will have noticed something that everyone else has missed is tiny. More likely you have misunder

[issue38052] Include sspipe Module with Core Python

2019-09-07 Thread Steven D'Aprano
Steven D'Aprano added the comment: Before proposing a third party module for inclusion in the standard library, you should check: - is the module mature and stable? - does it have an FOSS licence compatible with Python, and if not, are the authors willing to re-licence it? - ar

[issue38060] precedence (relational, logical operator)not working with single value

2019-09-09 Thread Steven D'Aprano
Steven D'Aprano added the comment: Tim is correct, the behaviour is right, however the docs could be clearer. I think what you are missing is that ``or`` and ``and`` are short-circuiting operators. So in the expression 9 or (anything) the "anything" expression never

[issue38060] precedence (relational, logical operator)not working with single value

2019-09-10 Thread Steven D'Aprano
Steven D'Aprano added the comment: I think that the problem is that the precedence table may be technically correct, but it doesn't describe the actual behaviour of expressions including the boolean operators ``or`` and ``and`` for exactly the reason Tim gives: > Precedence ru

[issue38099] __dict__ attribute is incorrectly stated to be read-only

2019-09-11 Thread Steven D'Aprano
Steven D'Aprano added the comment: "The implementation adds a few special read-only attributes to several object TYPES" [emphasis added] py> class MyType: ... pass ... py> MyType.__dict__ = {} Traceback (most recent call last): File "", line 1, in Attr

[issue38099] __dict__ attribute is incorrectly stated to be read-only

2019-09-11 Thread Steven D'Aprano
Steven D'Aprano added the comment: Oh, another point... Python is a little more complicated than some other languages, like Java, because Python classes (types) are themselves instances (objects) of yet another class (the so called "metaclass"). Ultimately, all classes ar

[issue38105] hash collision when hash(x) == -2 causes many calls to __eq__

2019-09-11 Thread Steven D'Aprano
Steven D'Aprano added the comment: Here's a possibly simpler version which nevertheless still shows multiple calls to __eq__ (in this case, only 6, not 13): class C(object): def __eq__(self, other): print('eq') return super().__eq__(other)

[issue37168] Decimal divisions sometimes 10x or 100x too large

2019-09-14 Thread Steven D'Aprano
Change by Steven D'Aprano : -- nosy: +steven.daprano ___ Python tracker <https://bugs.python.org/issue37168> ___ ___ Python-bugs-list mailing list Unsubscr

[issue38171] super() is passing wrong parameters while handling diamond inheritance

2019-09-14 Thread Steven D'Aprano
Change by Steven D'Aprano : -- nosy: +steven.daprano ___ Python tracker <https://bugs.python.org/issue38171> ___ ___ Python-bugs-list mailing list Unsubscr

[issue38213] sys.maxsize returns incorrect docstring.

2019-09-18 Thread Steven D'Aprano
Steven D'Aprano added the comment: This is not a bug. ``sys.maxsize`` is just an int instance, and it has no docstring itself. When you look up ``sys.maxsize.__doc__``, or call ``help(sys.maxsize)``, the ordinary inheritance rules apply and you get the class docstring. There is no

[issue38262] Mixins - super calls in bases of multiple-inheritance with different parameters

2019-09-24 Thread Steven D'Aprano
Steven D'Aprano added the comment: Are your tests so huge that you need to gzip them before uploading? That makes them extremely difficult to read from the browser, and makes me extremely suspicious that this could be some form of zip bomb or other malware. Couldn't you upload a

[issue38262] Mixins - super calls in bases of multiple-inheritance with different parameters

2019-09-24 Thread Steven D'Aprano
Steven D'Aprano added the comment: I took the health of my PC into my hands *smiles* and unzipped your test cases. I don't know .sh scripts well, so I didn't run that (and Windows users won't be able to run it), but I looked at the Python scripts, and I think I have

[issue38262] Mixins - super calls in bases of multiple-inheritance with different parameters

2019-09-24 Thread Steven D'Aprano
Steven D'Aprano added the comment: I'm not an expert on super and multiple inheritance, but let me see if I can explain what is going on. (Hopefully an expert will correct me if I get something wrong.) 1. The class C(A_With_Arg, B_With_Arg) is straight-forward: the super call

[issue38262] Mixins - super calls in bases of multiple-inheritance with different parameters

2019-09-24 Thread Steven D'Aprano
Steven D'Aprano added the comment: Apologies for the Python 2.7 incompatible syntax, I hadn't noticed that you had selected 2.7. But since 2.7 (and 3.8) are in feature freeze, any behavoural changes can only apply to 3.9 or later. I'm afraid that you haven't explained wh

[issue38262] Mixins - super calls in bases of multiple-inheritance with different parameters

2019-09-25 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Tue, Sep 24, 2019 at 08:54:49PM +, Arno-Can Uestuensoez wrote: > Or reduced to the focus of the actual issue and depicted the actual > passed parameters. See the following "Case 4 - same as > mixin_C_is_B0A1" for the essen

[issue38307] Provide Class' end line in readmodule module

2019-09-28 Thread Steven D'Aprano
Steven D'Aprano added the comment: What `readmodule` are you referring to? 3.6 is in feature-freeze. The earliest that any enhancement could be added is version 3.9. Can you explain how having an ending line number as well as the starting line number can be used to check which import

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

2019-09-29 Thread Steven D'Aprano
Steven D'Aprano added the comment: Sounds like a great idea to me. Thanks, Steven -- ___ Python tracker <https://bugs.python.org/issue38308> ___ ___ Pytho

[issue38362] platform.system() comparison problem

2019-10-03 Thread Steven D'Aprano
Steven D'Aprano added the comment: This is nothing to do with platform.system. You can see the same behaviour with any string comparison, or ints. The `is` operator is not a cute way of spelling `==`, it tests for object identity, not equality. It tests whether the two arguments ar

[issue38365] Issue 38363 - False Alarm - Sorry!

2019-10-03 Thread Steven D'Aprano
Steven D'Aprano added the comment: Please don't create a *second* bug report to say that your previous bug report was erroneous. Just go and close the first one. -- nosy: +steven.daprano resolution: -> not a bug stage: -> resolved status

[issue38363] No Module named ..." and UTF-8 Byte Order Marks

2019-10-03 Thread Steven D'Aprano
Steven D'Aprano added the comment: False alarm, see Stephen Tucker's message here https://bugs.python.org/issue38365#msg353854 File name has a trailing space which is why it wasn't found. -- nosy: +steven.daprano resolution: -> works for me stage: ->

[issue38386] ModuleNotFoundError: No module named '_ctypes'

2019-10-06 Thread Steven D'Aprano
Steven D'Aprano added the comment: I agree with Ned closing this issue, but just glancing at the logs, it looks to me like buildozer has shadowed your Python's ctypes with a broken ctypes in /home/yzw/Desktop/Test/.buildozer/android/platform/build/build/other_builds/hostpytho

[issue38382] statistics.harmonic_mean fails to raise error with negative input that follows a 0

2019-10-06 Thread Steven D'Aprano
Steven D'Aprano added the comment: Thanks Warren, the resistance example is excellent, would you like to write up a PR to add it to the docs? In the original design, I prohibited negative numbers because that seems to be what everyone says you should do, but as far as I can tell

[issue38399] Error message persists when reimporting library

2019-10-07 Thread Steven D'Aprano
Steven D'Aprano added the comment: Importing the second and subsequent times reloads the module from the system cache. Instead, you can: - run ``del sys.modules['hexdump']`` and then ``import hexdump``; - call ``importlib.reload(hexdump)``; or - restart the REPL. Remember

[issue38420] defaultdict does not support parametric lambda

2019-10-09 Thread Steven D'Aprano
Steven D'Aprano added the comment: All versions below 3.9 are in feature freeze, so they cannot get new features. This requested feature is already supported by subclassing ``dict`` and giving it a ``__missing__`` method. See issue #38315 -- nosy: +steven.daprano resol

[issue38451] Datetime definition does not work in function definition as list definition

2019-10-12 Thread Steven D'Aprano
Steven D'Aprano added the comment: This is not a bug, this is the design of function default arguments. Default arguments in Python use *early binding*, which means they are calculated once, when the function is declared, rather than *late binding*, which means they are calculated each

[issue38451] Datetime definition does not work in function definition as list definition

2019-10-12 Thread Steven D'Aprano
Steven D'Aprano added the comment: Oh, I forgot to mention that this is discussed in one of the FAQs: https://docs.python.org/3/faq/programming.html#why-are-default-values-shared-between-objects -- ___ Python tracker <https://bugs.py

[issue38458] lists

2019-10-12 Thread Steven D'Aprano
Steven D'Aprano added the comment: This is not a bug, it is part of the design of the language. Assignment in Python does not make a copy of lists, or any other object. In your sample code, p and l are two names for the same list, like "Devor Blake Daniels" and "dev4057

[issue38458] lists

2019-10-12 Thread Steven D'Aprano
Change by Steven D'Aprano : -- nosy: +pablogsal ___ Python tracker <https://bugs.python.org/issue38458> ___ ___ Python-bugs-list mailing list Unsubscr

[issue38475] Break Statement

2019-10-14 Thread Steven D'Aprano
Steven D'Aprano added the comment: Define "malfunction". Are we supposed to know what your code is meant to do, as well as what it actually does? Please don't use the bug tracker as a help desk for your own scripts. There are many forums where you can ask for help, such

[issue38490] statistics: add covariance and Pearson's correlation

2019-10-16 Thread Steven D'Aprano
Steven D'Aprano added the comment: I can't speak for other countries, but in Australia, secondary school mathematics teaches correlation coefficient and linear regression from Year 11 onwards (typically ages 16 or 17). Covariance is not itself taught, and as far as I can tell neit

[issue38496] Python3 allows mixture of tabs and spaces for indentation

2019-10-16 Thread Steven D'Aprano
Steven D'Aprano added the comment: I believe that the interpreter only requires that each block is consistent, not that all blocks in a module are consistent. -- nosy: +steven.daprano ___ Python tracker <https://bugs.python.org/is

[issue38512] bug of the v3.7 API document demo case code

2019-10-18 Thread Steven D'Aprano
Steven D'Aprano added the comment: What is this a screen shot of? What error occurs? The picture doesn't show any errors that I can see. Please COPY and PASTE the code you are running, as text, and the FULL EXCEPTION (the traceback and error message), if there is one. We cannot

[issue38516] PEP 3132 -- Extended Iterable Unpacking inconsistent assignment of * variable

2019-10-18 Thread Steven D'Aprano
Steven D'Aprano added the comment: Why would they give the same result when the code is different? #1 assign c, d, e and everything left over goes into b *b, c, d, e, = [1, 2, 3, 4] #2 assign c, d and everything left over goes into b *b, c, d, = [1, 2, 3, 4] #3 ass

[issue38307] Provide Class' end line in pyclbr module

2019-10-18 Thread Steven D'Aprano
Change by Steven D'Aprano : -- title: Provide Class' end line in readmodule module -> Provide Class' end line in pyclbr module ___ Python tracker <https://bugs.

[issue38524] functools.cached_property is not supported for setattr

2019-10-19 Thread Steven D'Aprano
Steven D'Aprano added the comment: The documentation doesn't mention ``__set_name__``, but it does say that cached_property is useful for properties which are "effectively immutable". The ``__set_name__`` error message is pretty cryptic, that seems to have something

[issue38556] Walrus operator in list comprehensions [Python 3.8.0]

2019-10-22 Thread Steven D'Aprano
Steven D'Aprano added the comment: We're not mind-readers, how do you expect us to know what you tried if you don't tell us? The walrus operator works for me: >>> [spam for c in "hello world" if (spam:=c.upper()) in 'AEIOU'] ['E&#x

[issue38556] Walrus operator in list comprehensions [Python 3.8.0]

2019-10-22 Thread Steven D'Aprano
Change by Steven D'Aprano : -- components: +Interpreter Core type: enhancement -> behavior ___ Python tracker <https://bugs.python.org/issue38556> ___ _

[issue38606] Function to count total number of common divisors of two numbers

2019-10-27 Thread Steven D'Aprano
Steven D'Aprano added the comment: Also, next time I suggest that you try running the code at least once before submitting it, as your code contains a syntax error that prevents it from running. -- nosy: +steven.daprano ___ Python tracker &

[issue38612] some non-ascii charcters link to same identifier/data

2019-10-28 Thread Steven D'Aprano
Steven D'Aprano added the comment: This is an intentional feature: identifiers are normalised using NFKC normalization. py> from dis import dis py> dis(compile('ฯ•=1', '', 'single')) 1 0 LOAD_CONST 0 (1)

[issue38612] some non-ascii charcters link to same identifier/data

2019-10-28 Thread Steven D'Aprano
Steven D'Aprano added the comment: Its also documented here: https://docs.python.org/3/reference/lexical_analysis.html#identifiers -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker <https:

[issue38637] fix GROWTH_RATE comments bug

2019-10-29 Thread Steven D'Aprano
Steven D'Aprano added the comment: Please explain the bug here on the bug tracker, people shouldn't have to drill down into the PR to find out what it means. Before fixing the bug, you should find out whether or not it actually is a bug. In my testing, the comment is approximate

[issue38382] statistics.harmonic_mean fails to raise error with negative input that follows a 0

2019-10-29 Thread Steven D'Aprano
Steven D'Aprano added the comment: Thank you for your comments, but accepting non-floats like Decimal and Fraction (and int, of course!) is a hard requirement for the statistics module. fmean will naturally convert any data to float for speed, but the other means will attempt to kee

[issue38382] statistics.harmonic_mean fails to raise error with negative input that follows a 0

2019-10-30 Thread Steven D'Aprano
Steven D'Aprano added the comment: Have you read the rest of the thread? There is a compelling reason to support harmonic mean including zero (resistors in parallel) but not yet any compelling reason to support negative values. If you have a good use-case for harmonic mean of neg

[issue38654] `urllib.request.Request` uses mutable value as default value

2019-10-31 Thread Steven D'Aprano
Steven D'Aprano added the comment: I agree with Serhiy that using mutable defaults is not automatically a bad idea. This is unnecessary code churn that fixes no bugs and adds no new functionality and doesn't make the code "better". The PR removes one harmless use of a

[issue38654] `urllib.request.Request` uses mutable value as default value

2019-11-01 Thread Steven D'Aprano
Steven D'Aprano added the comment: > Also, if some new Python coders saw `[]` or `{}` being used as default > values in the standard library, they might think โ€œIโ€™ll do it too since > the standard library does itโ€. Great! Having Python coders learn good progamming skills from

[issue38703] should we expect round(0.95, 1) to be 1.0, instead of 0.9?

2019-11-05 Thread Steven D'Aprano
Steven D'Aprano added the comment: Possibly even easier than using Decimal: py> '%.17f' % 0.95 '0.94996' BTW, this is a FAQ: https://docs.python.org/3/faq/design.html#why-are-floating-point-calculations-so-inaccurate

[issue38706] What should the error message in the exception raised by assertTrue and assertFalse be?

2019-11-05 Thread Steven D'Aprano
Steven D'Aprano added the comment: I'm reopening this as an enhancement, because I think Mikeli is onto something here. I'd like to propose making the messages: "False is not a truthy value." "True is not a falsey value." to make it expli

[issue38706] What should the error message in the exception raised by assertTrue and assertFalse be?

2019-11-05 Thread Steven D'Aprano
Steven D'Aprano added the comment: Since error messages aren't part of the API and backwards-compatibility doesn't apply to them, this could still go into 3.8. -- stage: resolved -> versions: +Python 3.8 -Python 3.9 ___ Pyth

[issue38706] What should the error message in the exception raised by assertTrue and assertFalse be?

2019-11-06 Thread Steven D'Aprano
Steven D'Aprano added the comment: I have tried sending this message by email twice, and both times it seems to have disappeared. So I'm commenting via the web, and my apologies in advance if the message shows up later. * > There are almost 500 occurrences of "is tr

[issue38740] Line count mis match between open() vs sys.stdin api calls

2019-11-08 Thread Steven D'Aprano
Steven D'Aprano added the comment: This seems to be the difference between Universal Newlines or not. In Python 2, you have to set it explicitly with a U in the open mode: $ python2.7 -c 'import sys; print("Linecount=", sum(1 for x in open(sys.argv[1], "U

[issue43489] Can't install, nothing to install

2021-03-13 Thread Steven D'Aprano
Steven D'Aprano added the comment: Please don't ask us to guess what you are doing. Where are you getting "both installer downloads" from? What installers are they? How are you running the installers? What is the actual error message please, not "something to th

[issue43519] access python private variable

2021-03-16 Thread Steven D'Aprano
Steven D'Aprano added the comment: This is not a bug, it is working as intended. Python does not really support "private" attributes, except by convention. Names that begin with a single leading underscore are no different than any other name to the interpreter, but the rea

[issue43516] python on raspberry pi

2021-03-16 Thread Steven D'Aprano
Steven D'Aprano added the comment: Yann, Eric is correct -- this isn't a help desk. Please ask your question on one of the many forums available for asking help, but before you do, please read: http://www.sscce.org/ https://stackoverflow.com/help/minimal-reproducible-example an

[issue43589] Using defaultdict as kwarg to function reuses same dictionary every function call

2021-03-22 Thread Steven D'Aprano
Steven D'Aprano added the comment: This is normal, expected behaviour and has nothing to do with defaultdicts specifically. Any mutable object would behave the same way. Function default parameters are evaluated only once, when the function is defined. They are not re-evaluated on each

[issue43737] Documentation of modulo operator should document behaviour clearly when second operator is negative

2021-04-05 Thread Steven D'Aprano
Steven D'Aprano added the comment: > the result is different from other languages which is why it can be > surprising. Maybe the other languages should be documenting their surprising result, which fails to preserve the identity? > Do we - add a warning to the [tutorial] page

[issue43786] slice(None) is slice(None) is False

2021-04-09 Thread Steven D'Aprano
Steven D'Aprano added the comment: The behaviour of `is` is correct. The `is` operator tests for object identity, not equality. The reason that `slice(None) is slice(None)` returns False is that the two calls to the slice function return two different objects. You say that using the e

[issue43801] Carriage Return problem in version v3.9.0:9cf6752

2021-04-10 Thread Steven D'Aprano
Steven D'Aprano added the comment: Hello Santosh, In future, please don't post images or screen shots of text, please copy and paste the text of your code. You have something similar to this: >>> text = "short line\rvery long line of text" >>> print(

[issue43830] (-1) ** 0.5 returns (6.123233995736766e-17+1j) instead of 1j

2021-04-13 Thread Steven D'Aprano
Steven D'Aprano added the comment: What do you mean? It works as I expected. Can you explain what you expected, and why? -- nosy: +steven.daprano ___ Python tracker <https://bugs.python.org/is

[issue43830] (-1) ** 0.5 returns (6.123233995736766e-17+1j) instead of 1j

2021-04-13 Thread Steven D'Aprano
Steven D'Aprano added the comment: Before replying please read: https://docs.python.org/3/faq/design.html#why-are-floating-point-calculations-so-inaccurate https://duckduckgo.com/?q=python+why+are+floating+point+so+inaccurate -- ___ P

[issue43830] (-1) ** 0.5 returns (6.123233995736766e-17+1j) instead of 1j

2021-04-13 Thread Steven D'Aprano
Steven D'Aprano added the comment: Sorry Nathan, I worded my first response awkwardly, of course mathematically we should expect a result of 1j, by why do you expect it in a floating point calculation? Do you have an alternative? (I promise this is my last comment until you have

[issue43837] Operator precedence documentation could be more clear

2021-04-14 Thread Steven D'Aprano
Steven D'Aprano added the comment: > There isn't any mention of variables. While not operators, probably worth > mentioning that they (effectively?) have higher precedence than any of the > operators. I'm sorry, I don't understand what that means. ---

[issue43887] it seems that sorted built-in always return floats before int if they appear to be equal

2021-04-19 Thread Steven D'Aprano
Steven D'Aprano added the comment: Hi John, you said: > it seems that sorted built-in always return floats before int if they appear > to be equal But that's not correct: >>> sorted([5.0, 5]) [5.0, 5] >>> sorted([5, 5.0]) [5, 5.0] Python's sort is

[issue43903] round() produces incorrect results with certain values

2021-04-21 Thread Steven D'Aprano
Steven D'Aprano added the comment: I concur with Eric that this should be closed. They're not "incorrect results", they are correct results, or at least *better* results. We did not invent the so-called Banker's Rounding technique, it has been the standard used by

[issue43906] turtle graphics don't work

2021-04-21 Thread Steven D'Aprano
New submission from Steven D'Aprano : You have a bug in your code. This is a bug tracker for bugs in Python, not a help desk for solving errors in your own code. In this case, the problem is that you have created a file called "turtle.py" which is shadowing the original turtle

[issue43924] print unexpected values in infinite loop

2021-04-23 Thread Steven D'Aprano
Steven D'Aprano added the comment: I'm closing this as "Works for me". rafihassan190041234, if you still think it is a bug in the language, rather than a bug in your code or a mistake in your understanding, you can re-open this with more details. As Zach already comment

[issue43929] Raise on threading.Event.__bool__ due to ambiguous nature

2021-04-24 Thread Steven D'Aprano
Steven D'Aprano added the comment: This is not a bug fix, it is a change of behaviour ("enhancement"). All of 3.6 through 3.9 are in feature freeze. 3.10 is probably in feature freeze, but if not it is extremely close to it. So this can only go into 3.11 and (maybe) 3.10. Bu

[issue43940] int casting to float results to a different value in memory

2021-04-25 Thread Steven D'Aprano
Steven D'Aprano added the comment: I believe that this may be the same issue as this thread https://mail.python.org/archives/list/python-...@python.org/thread/35NECLGFIVAHWTIPAYDBJOJJX3FSY233/ in particular this comment: https://mail.python.org/archives/list/python-...@python.org/me

[issue43980] netrc module looks for .netrc even on Windows where the convention is _netrc

2021-04-29 Thread Steven D'Aprano
Steven D'Aprano added the comment: This is a behaviour change not a simple bug fix. 3.6 through 3.9 are all in feature-freeze, and we're days away from the same for 3.10. Not that I don't believe you about the _netrc convention on Windows, but do you have a link to a

[issue44028] Request for locals().update() to work, it is

2021-05-04 Thread Steven D'Aprano
Steven D'Aprano added the comment: > loading the entire game or DNN (from STDIN) can be simply put into one line > as `locals().update(eval(sys.stdin.read()))` This is how you get command injection attacks. https://owasp.org/www-community/attacks/Command_Injection https://cw

[issue44054] 2**53+1 != float(2**53+1)

2021-05-06 Thread Steven D'Aprano
Steven D'Aprano added the comment: This is not a bug. It is *literally correct* that the int 9007199254740993 is not equal to the float 9007199254740992.0 so I really don't know why you would desire a different result. If you want to compare two floats, compare two floats, not an

[issue44076] issue with list in Python 3.8.5

2021-05-08 Thread Steven D'Aprano
Steven D'Aprano added the comment: I doubt it is a memory issue. Tell us what investigation you did that lead you to that conclusion. Python code doesn't normally just stop working for no reason. I expect that you changed your code in some way and introduced a bug. This is not a

[issue44076] issue with list in Python 3.8.5

2021-05-09 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Sun, May 09, 2021 at 10:04:29PM +, Mohamed wrote: > As I mentioned, It seems that the recent update of Windows has affected > Tkinter, > so that mainloop is not working after the first time That isn't what it looks like to me.

[issue44076] issue with list in Python 3.8.5

2021-05-09 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Sun, May 09, 2021 at 11:55:56PM +, Mohamed wrote: > Please find attached, the demo with dummy data. As I mentioned, it was > working fine until May 1st. If it was working fine until May 1st, I would start my investigation by look

[issue44151] Improve parameter names and return value ordering for linear_regression

2021-05-16 Thread Steven D'Aprano
Steven D'Aprano added the comment: I agree with you that "regressor" is too obscure and should be changed. I disagree about the "y = mx + c". Haven't we already discussed this? That form is used in linear algebra, but not used in statistics. Quoting from Yale:

[issue44151] Improve parameter names and return value ordering for linear_regression

2021-05-16 Thread Steven D'Aprano
Steven D'Aprano added the comment: > The named tuple should be called Line because that is what it describes. > Also, a Line class would be reusuable for other purposes that linear > regression. I think that most people would expect that a Line class would represent a straig

[issue44151] Improve parameter names and return value ordering for linear_regression

2021-05-17 Thread Steven D'Aprano
Steven D'Aprano added the comment: > The ML world has collapsed on the terms X and y. (With that > capitalization). I just googled for "ML linear regression" and there is no consistency in either the variable used or the parameters. But most seem to use lowercase x,y. O

[issue44216] Bug in class method with optional parameter

2021-05-23 Thread Steven D'Aprano
Steven D'Aprano added the comment: This is not a bug, this is working as the language is designed, and the behaviour occurs for all functions, not just class methods. Default values are only evaluated once, when the function is defined, not every time the function is called. This is

[issue44217] [IDLE] Weird behaviour in IDLE while dealing with non-ASCII characters

2021-05-23 Thread Steven D'Aprano
Steven D'Aprano added the comment: The smiley emoji ๐Ÿ˜€ is U+1F600 which is outside of the Unicode Basic Multilingual Plane (BMP). IDLE's underlying graphical toolkit, Tcl/Tk, has problems with Unicode characters outside of the BMP, so this may not be fixable by us. If all you

[issue44266] AttributeError: module 'sys' has no attribute 'original_stdout'

2021-05-29 Thread Steven D'Aprano
Steven D'Aprano added the comment: Correct, sys has no attribute 'original_stdout'. Do you have a file called `sys.py`? Rename it. -- nosy: +steven.daprano ___ Python tracker <https://bugs.pyt

[issue44272] DeprecationWarning: The *random* parameter to shuffle() has been deprecated since Python 3.9 and will be removed in a subsequent version

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

[issue44276] Replace if-elif-else structure with match-case (PEP634)

2021-06-01 Thread Steven D'Aprano
Steven D'Aprano added the comment: match-case has not even reached a stable version of Python yet, it is only available in Python 3.10 which is still in beta. Are we sure that it is faster in all cases and how do you know it is more intuitive when the vast majority of Python users

[issue44276] Replace if-elif-else structure with match-case (PEP634)

2021-06-02 Thread Steven D'Aprano
Steven D'Aprano added the comment: How did you do the timing? -- ___ Python tracker <https://bugs.python.org/issue44276> ___ ___ Python-bugs-list m

[issue44308] Raw Strings lack parody

2021-06-03 Thread Steven D'Aprano
Steven D'Aprano added the comment: I think you have missed something important here: >>> data = b'foo\bar' >>> len(data) 6 >>> print(data) b'foo\x08ar' If you want bytes including a backslash followed by a b, you need t

[issue44308] Raw Strings lack parody

2021-06-03 Thread Steven D'Aprano
Steven D'Aprano added the comment: Remember that backslash escapes are only a Python syntactic feature. If you read data from a file, or from the input() builtin, that contains a backslash, it remains a backslash: >>> s = input() a\b >>> print(len(s),

[issue44332] For Loop temporary variable scope should be local to For loop

2021-06-06 Thread Steven D'Aprano
Steven D'Aprano added the comment: This is not a bug, it is intentional design and has been since Python 1. You are incorrect about x consuming memory "always". If the value bound to x is in use elsewhere, deleting x will save no memory. If the value is not in use elsewh

[issue44332] For Loop temporary variable scope should be local to For loop

2021-06-06 Thread Steven D'Aprano
Steven D'Aprano added the comment: By the way, loop variables are not considered to be "temporary" in Python. They are no more temporary than any other local variable -- they *are* local variables with exactly the same scope and lifetime as all other

[issue44341] Conflict between re.match and match keyword

2021-06-07 Thread Steven D'Aprano
Steven D'Aprano added the comment: `match` is a soft keyword. Which means that the interpreter should still recognise `match 'str': ...` even if the *name* "match" is defined. -- nosy: +steven.daprano ___ Python tracker

[issue44355] Allow spaces in format strings

2021-06-08 Thread Steven D'Aprano
New submission from Steven D'Aprano : Format strings should allow spaces around keys and indices. This might be as simple as running str.strip() on the contents of curly braces? Aside from indentation and newlines, in most other contexts whitespace is insignificant. E.g. in subscripting

[issue44339] Discrepancy between math.pow(0.0, -inf) and 0.0**-inf

2021-06-09 Thread Steven D'Aprano
Change by Steven D'Aprano : -- nosy: +steven.daprano ___ Python tracker <https://bugs.python.org/issue44339> ___ ___ Python-bugs-list mailing list Unsubscr

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