[issue39108] random needs doc for "gauss" versus "normalvariate"

2020-10-25 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue39108>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39108] random needs doc for "gauss" versus "normalvariate"

2020-10-25 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset af891a962b62268d76ace0d4768ab0e1934a2cd1 by Miss Skeleton (bot) 
in branch '3.9':
bpo-39108: Document threading issues for random.gauss() (GH-22928) (GH-22972)
https://github.com/python/cpython/commit/af891a962b62268d76ace0d4768ab0e1934a2cd1


--

___
Python tracker 
<https://bugs.python.org/issue39108>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39108] random needs doc for "gauss" versus "normalvariate"

2020-10-25 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset 3cde3788b68bce7deee1e6d31e265bbfce337731 by Raymond Hettinger in 
branch 'master':
bpo-39108: Document threading issues for random.gauss() (GH-22928)
https://github.com/python/cpython/commit/3cde3788b68bce7deee1e6d31e265bbfce337731


--

___
Python tracker 
<https://bugs.python.org/issue39108>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42127] functools.cached_property possibly disables key-sharing instance dictionaries

2020-10-24 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset 427cb0aa78813b89a3f100073bf7d70a53510f57 by Miss Skeleton (bot) 
in branch '3.9':
bpo-42127:  Document effect of cached_property on key-sharing dictionaries 
(GH-22930) (GH-22955)
https://github.com/python/cpython/commit/427cb0aa78813b89a3f100073bf7d70a53510f57


--

___
Python tracker 
<https://bugs.python.org/issue42127>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42127] functools.cached_property possibly disables key-sharing instance dictionaries

2020-10-24 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.9

___
Python tracker 
<https://bugs.python.org/issue42127>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42127] functools.cached_property possibly disables key-sharing instance dictionaries

2020-10-24 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset 48be6b1ef7a6201e13c87a317361cdb60bd5faa8 by Raymond Hettinger in 
branch 'master':
bpo-42127:  Document effect of cached_property on key-sharing dictionaries 
(GH-22930)
https://github.com/python/cpython/commit/48be6b1ef7a6201e13c87a317361cdb60bd5faa8


--

___
Python tracker 
<https://bugs.python.org/issue42127>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19072] classmethod doesn't honour descriptor protocol of wrapped callable

2020-10-23 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset c17f63fae57dc02e78bd6931b8fb6c6c2f9d4d81 by Miss Skeleton (bot) 
in branch '3.9':
bpo-19072: Update descriptor howto for decorator chaining (GH-22934) (GH-22935)
https://github.com/python/cpython/commit/c17f63fae57dc02e78bd6931b8fb6c6c2f9d4d81


--

___
Python tracker 
<https://bugs.python.org/issue19072>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19072] classmethod doesn't honour descriptor protocol of wrapped callable

2020-10-23 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset 8e5b0fdce337ef0a1f4f38b31a8c6b66c56b16d2 by Raymond Hettinger in 
branch 'master':
bpo-19072: Update descriptor howto for decorator chaining (GH-22934)
https://github.com/python/cpython/commit/8e5b0fdce337ef0a1f4f38b31a8c6b66c56b16d2


--

___
Python tracker 
<https://bugs.python.org/issue19072>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19072] classmethod doesn't honour descriptor protocol of wrapped callable

2020-10-23 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
pull_requests: +21854
pull_request: https://github.com/python/cpython/pull/22934

___
Python tracker 
<https://bugs.python.org/issue19072>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42127] functools.cached_property possibly disables key-sharing instance dictionaries

2020-10-23 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
assignee:  -> docs@python
components: +Documentation -Library (Lib)
nosy: +docs@python

___
Python tracker 
<https://bugs.python.org/issue42127>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42127] functools.cached_property possibly disables key-sharing instance dictionaries

2020-10-23 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
keywords: +patch
pull_requests: +21852
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/22930

___
Python tracker 
<https://bugs.python.org/issue42127>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39108] random needs doc for "gauss" versus "normalvariate"

2020-10-23 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
keywords: +patch
pull_requests: +21850
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/22928

___
Python tracker 
<https://bugs.python.org/issue39108>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42127] functools.cached_property possibly disables key-sharing instance dictionaries

2020-10-23 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> Essentially it means that types using cached_property are less
> likely to enjoy the benefits of shared keys.

I don't think anything can be done about it.  @cached_property and key-sharing 
dicts are intrinsically at odds with one another.  Likewise, @cached_property 
doesn't work with classes that define __slots__.

FWIW, there is an alternative that works with both key-sharing dicts and 
__slots__.  You can stack property() on top of functools.cache():

class A:
def __init__(self, x):
self.x = x

@property
@cache
def square(self):
print('Called!')
return self.x ** 2


>>> a = A(10)
>>> a.square
Called!
100
>>> b = A(11)
>>> b.square
Called
121
>>> a.square
100
>>> b.square
121

--
nosy: +rhettinger

___
Python tracker 
<https://bugs.python.org/issue42127>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34394] Descriptors HowTo doesn't mention __set_name__

2020-10-23 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
resolution:  -> fixed
stage:  -> resolved
status: open -> closed
versions: +Python 3.10, Python 3.9 -Python 3.4, Python 3.5, Python 3.6, Python 
3.7, Python 3.8

___
Python tracker 
<https://bugs.python.org/issue34394>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42122] macOS complains about how fonts are accessed

2020-10-23 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I'm going to mark this as closed, not a bug.  If you're not seeing the same 
result, it is almost certainly an issue with my local build.

--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue42122>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42122] macOS complains about how fonts are accessed

2020-10-23 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I'm only Catalina 10.15.7 and am using a local build constructed with:

   ./configure --with-openssl=$(brew --prefix openssl) && make

Perhaps that is using the system Tk and we don't need to worry about this.

--

___
Python tracker 
<https://bugs.python.org/issue42122>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34394] Descriptors HowTo doesn't mention __set_name__

2020-10-23 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

See https://github.com/python/cpython/pull/22906

--

___
Python tracker 
<https://bugs.python.org/issue34394>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42122] IDLE complains about how fonts are accessed

2020-10-22 Thread Raymond Hettinger


New submission from Raymond Hettinger :

This occurs immediately on startup:

$ python310 -m idlelib.idle
2020-10-22 16:20:19.400 python.exe[80008:1598908] CoreText note: Client 
requested name ".SFNSMono-Regular", it will get Times-Roman rather than the 
intended font. All system UI font access should be through proper APIs such as 
CTFontCreateUIFontForLanguage() or +[NSFont systemFontOfSize:].
2020-10-22 16:20:19.400 python.exe[80008:1598908] CoreText note: Set a 
breakpoint on CTFontLogSystemFontNameRequest to debug.
2020-10-22 16:20:19.450 python.exe[80008:1598908] CoreText note: Client 
requested name ".SF NS Mono", it will get Times-Roman rather than the intended 
font. All system UI font access should be through proper APIs such as 
CTFontCreateUIFontForLanguage() or +[NSFont systemFontOfSize:].
2020-10-22 16:20:28.100 python.exe[80008:1598908] CoreText note: Client 
requested name ".SFNSMono-Regular", it will get Times-Roman rather than the 
intended font. All system UI font access should be through proper APIs such as 
CTFontCreateUIFontForLanguage() or +[NSFont systemFontOfSize:].
2020-10-22 16:20:28.100 python.exe[80008:1598908] CoreText note: Client 
requested name ".SF NS Mono", it will get Times-Roman rather than the intended 
font. All system UI font access should be through proper APIs such as 
CTFontCreateUIFontForLanguage() or +[NSFont systemFontOfSize:].
2020-10-22 16:20:28.101 python.exe[80008:1598908] CoreText note: Client 
requested name ".SFNSMono-Regular", it will get Times-Roman rather than the 
intended font. All system UI font access should be through proper APIs such as 
CTFontCreateUIFontForLanguage() or +[NSFont systemFontOfSize:].
2020-10-22 16:20:28.124 python.exe[80008:1598908] CoreText note: Client 
requested name ".SFNSMono-Regular", it will get Times-Roman rather than the 
intended font. All system UI font access should be through proper APIs such as 
CTFontCreateUIFontForLanguage() or +[NSFont systemFontOfSize:].
2020-10-22 16:20:28.124 python.exe[80008:1598908] CoreText note: Client 
requested name ".SF NS Mono", it will get Times-Roman rather than the intended 
font. All system UI font access should be through proper APIs such as 
CTFontCreateUIFontForLanguage() or +[NSFont systemFontOfSize:].
2020-10-22 16:20:28.124 python.exe[80008:1598908] CoreText note: Client 
requested name ".SFNSMono-Regular", it will get Times-Roman rather than the 
intended font. All system UI font access should be through proper APIs such as 
CTFontCreateUIFontForLanguage() or +[NSFont systemFontOfSize:].

--
assignee: terry.reedy
components: IDLE
messages: 379382
nosy: rhettinger, terry.reedy
priority: normal
severity: normal
status: open
title: IDLE complains about how fonts are accessed
versions: Python 3.10

___
Python tracker 
<https://bugs.python.org/issue42122>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42118] TypeError gives wrong reserved name

2020-10-22 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Closing as "not a bug".

--
nosy: +rhettinger
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue42118>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42102] Make builtins.callable "generic"

2020-10-20 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
nosy: +gvanrossum, levkivskyi

___
Python tracker 
<https://bugs.python.org/issue42102>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41397] Restore default implementation of __ne__ in Counter

2020-10-19 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
resolution:  -> not a bug
stage: patch review -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue41397>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4356] Add "key" argument to "bisect" module functions

2020-10-19 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue4356>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4356] Add "key" argument to "bisect" module functions

2020-10-19 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset 871934d4cf00687b3d1411c6e344af311646c1ae by Raymond Hettinger in 
branch 'master':
bpo-4356: Add key function support to the bisect module (GH-20556)
https://github.com/python/cpython/commit/871934d4cf00687b3d1411c6e344af311646c1ae


--

___
Python tracker 
<https://bugs.python.org/issue4356>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42066] CookieJar cookies should not be sorted

2020-10-19 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
versions:  -Python 3.6, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 
<https://bugs.python.org/issue42066>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42083] PyStructSequence_NewType broken in 3.8

2020-10-19 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
priority: normal -> high

___
Python tracker 
<https://bugs.python.org/issue42083>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42084] Language aware diff headers

2020-10-19 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue42084>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42084] Language aware diff headers

2020-10-19 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset 95ad890a7b0341d8d2fde13f824bc24c65a8ece0 by Raymond Hettinger in 
branch 'master':
bpo-42084: Language aware diff headers (GH-22776)
https://github.com/python/cpython/commit/95ad890a7b0341d8d2fde13f824bc24c65a8ece0


--

___
Python tracker 
<https://bugs.python.org/issue42084>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42084] Language aware diff headers

2020-10-19 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
keywords: +patch
pull_requests: +21737
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/22776

___
Python tracker 
<https://bugs.python.org/issue42084>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42084] Language aware diff headers

2020-10-19 Thread Raymond Hettinger


New submission from Raymond Hettinger :

Improve our development environment by making the diff headers language aware.

See:  
https://tekin.co.uk/2020/10/better-git-diff-output-for-ruby-python-elixir-and-more

--
components: Build
messages: 378980
nosy: rhettinger
priority: normal
severity: normal
status: open
title: Language aware diff headers
versions: Python 3.10

___
Python tracker 
<https://bugs.python.org/issue42084>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42026] index function return first index for same element if repetitive in a list

2020-10-19 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> If the index() is working fine. why my previous attached
> code sample is returning 0 for each time I try to get 
> the index for element 11 in the list.

Your code is buggy.  It assumes that list.index() changes its starting point as 
your for-loop iterates.   However, the documented and correct behavior of 
list.index() is that unless a *start* argument is provided, the search always 
starts at position zero and returns the index of the first matching target 
value:  

>>> help(list.index)
Help on method_descriptor:

index(self, value, start=0, stop=9223372036854775807, /)
Return first index of value.

--

___
Python tracker 
<https://bugs.python.org/issue42026>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42071] Shelve should default to the default Pickle protocol instead of hardcoding version 3

2020-10-18 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

This seems reasonable to me.

There might be some issue is existing code where different versions of Python 
are sharing the same shelf, but I don't think this is common.

--
nosy: +rhettinger

___
Python tracker 
<https://bugs.python.org/issue42071>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42066] CookieJar cookies should not be sorted

2020-10-18 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

The seems reasonable to me.  Likely, the sorting was originally added to make 
the execution order deterministic.  Now that dicts remember insertion order, 
that is no longer necessary.  Helpfully, the docs do not specify sorting, so 
there is no guaranteed behavior.  That said, there is some risk that 
applications or their tests depend on the existing behavior.

--
nosy: +rhettinger

___
Python tracker 
<https://bugs.python.org/issue42066>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42069] Make filecmp more pythonic

2020-10-18 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

In general, we don't accept patches like this:

* It risks breaks (in fact the tests are failing.
* We're not apply Black's quoting preferences to existing files.
* We're not yet adding type annotations through out.
* The PR introduces multiple new dependencies on other modules.
  This tends to slow down load time and complicate maintenance.
* There are subtle changes to the logic and API because
  of the dataclasses, cached_property, and lru_cache.
* We want to avoid code churn because it reduces stability
  and because it complicates maintenance (making it harder to
  apply fixes across versions).

Thank you for the suggestion, but we'll decline.

--
nosy: +rhettinger
resolution:  -> rejected
stage: patch review -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue42069>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41822] Document the meaning of values for sys.float_info.rounds

2020-10-18 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Here's a link:  http://c0x.coding-guidelines.com/5.2.4.2.2.html

--

___
Python tracker 
<https://bugs.python.org/issue41822>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41822] Document the meaning of values for sys.float_info.rounds

2020-10-18 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Also, we should document the meaning of the other fields.  Several of them are 
not self explanatory:

min_10_exp = -307

   does not mean that 2.3e-308 isn't normalized

   does mean that 10**-307 is normalized and 10**-308 isn't


min_exp = -1021

   does not mean that 2**-1021 is the lowest normalized value

   does mean ldexp(0.5, -1021) == float_info.min


decimal_dig = 15

   does not mean digits required to specify every unique float

   does mean, "number of decimal digits, q, such that any 
   floating-point number with q decimal digits can be rounded
   into a floating-point number with p radix b digits and back
   again without change to the q decimal digits"

--

___
Python tracker 
<https://bugs.python.org/issue41822>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36201] AssertCountEqual does not work for nested dictionaries.

2020-10-17 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
resolution:  -> rejected
stage:  -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue36201>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40341] Programming FAQ includes actively discouraged solutions; Should those be removed?

2020-10-16 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Dominik, thanks for the suggestion.

Zackery, thanks for the PR.

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue40341>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40341] Programming FAQ includes actively discouraged solutions; Should those be removed?

2020-10-16 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset 0fbddb14dc03f61738af01af88e7d8aa8df07336 by Miss Skeleton (bot) 
in branch '3.9':
bpo-40341: Remove some "discouraged solutions" in Doc/faq/programming.rst 
(GH-22726) (GH-22727)
https://github.com/python/cpython/commit/0fbddb14dc03f61738af01af88e7d8aa8df07336


--

___
Python tracker 
<https://bugs.python.org/issue40341>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42028] Regression in mimetypes for image/bmp

2020-10-16 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
nosy: +steve.dower

___
Python tracker 
<https://bugs.python.org/issue42028>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40341] Programming FAQ includes actively discouraged solutions; Should those be removed?

2020-10-16 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
versions: +Python 3.10 -Python 3.8

___
Python tracker 
<https://bugs.python.org/issue40341>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40341] Programming FAQ includes actively discouraged solutions; Should those be removed?

2020-10-16 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset a22a19f3548f6064035e7c59a19cda1e9506db92 by Zackery Spytz in 
branch 'master':
bpo-40341: Remove some "discouraged solutions" in Doc/faq/programming.rst 
(GH-22726)
https://github.com/python/cpython/commit/a22a19f3548f6064035e7c59a19cda1e9506db92


--

___
Python tracker 
<https://bugs.python.org/issue40341>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42033] Seemingly unnecessary complexification of foo(**kw)

2020-10-15 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
assignee:  -> Mark.Shannon

___
Python tracker 
<https://bugs.python.org/issue42033>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41904] datetime.datetime.today makes no sense and should be removed

2020-10-14 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I concur with the other respondents.  This ship has sailed.

--
nosy: +rhettinger

___
Python tracker 
<https://bugs.python.org/issue41904>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42023] Argparse: Add a "display" arg

2020-10-13 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> and the metavar arg isn't really helpful.

Is your issue with *metavar* that it changes the help() output in two places?

--

___
Python tracker 
<https://bugs.python.org/issue42023>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42026] index function return first index for same element if repetitive in a list

2020-10-13 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue42026>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42026] index function return first index for same element if repetitive in a list

2020-10-13 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

The index() method is working as expected.  This isn't a bug.

The easiest way to accomplish your goal is to use enumerate() with a list 
comprehension:

>>> po = [11,22,33,44,11,55,66,11,88]
>>> [i for i, value in enumerate(po) if value == 11]
[0, 4, 7]

--
nosy: +rhettinger

___
Python tracker 
<https://bugs.python.org/issue42026>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42017] Add new type in typing

2020-10-12 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
nosy: +gvanrossum, levkivskyi

___
Python tracker 
<https://bugs.python.org/issue42017>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41988] No hyphen in broken up word in documentation

2020-10-12 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I've been seeing this throughout the docs.

--
nosy: +rhettinger

___
Python tracker 
<https://bugs.python.org/issue41988>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42007] Line continuation after Boolean operation

2020-10-11 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Sorry, I don't think this proposal has a chance.  

Python doesn't require statement terminators like ";" in C.  Accordingly, it 
needs to have a clean and consistent rule to close a statement.  The rule that 
has worked well for us it that a statement is terminated by a newline unless 
there is a line continuation character, or a colon to begin a new suite, or an 
open expression delimiter (parenthesis, square bracket or curly brace). 

Adding a special case exception to the rule might look nice but would 
complicate learning the language, and it would complicate the implementation as 
well.

--
nosy: +rhettinger

___
Python tracker 
<https://bugs.python.org/issue42007>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42008] Internal Random class calling seed() with incorrect argument

2020-10-11 Thread Raymond Hettinger


New submission from Raymond Hettinger :

The C code in random_new() incorrectly calls random_seed() with an args tuple. 
Instead, it should use first element of the args tuple.

This matters because we've deprecated using PyObject_Hash() in random_seed().  
Once that is removed, _random.Random(someseed) won't work at all (there's a 
test for it).

# Public API is correct
>>> from random import Random
>>> r = Random()
>>> r.seed(8675309)
>>> r.random()
0.40224696110279223
>>> r = Random(8675309)
>>> r.random()
0.40224696110279223

# Private API is incorrect for Random(someseed)
>>> from _random import Random
>>> r = Random()
>>> r.seed(8675309)
>>> r.random()
0.40224696110279223
>>> r = Random(8675309)  
>>> r.random()
0.21095576307886765  <=== This is wrong

--
components: Extension Modules
keywords: easy (C)
messages: 378457
nosy: rhettinger
priority: normal
severity: normal
status: open
title: Internal Random class calling seed() with incorrect argument
type: behavior
versions: Python 3.10, Python 3.8, Python 3.9

___
Python tracker 
<https://bugs.python.org/issue42008>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41980] Argparse documentation is slightly misleading

2020-10-09 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

That sounds likes reasonable improvement.  Would you like to submit a PR?

--

___
Python tracker 
<https://bugs.python.org/issue41980>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41974] Remove complex.__float__, complex.__floordiv__, etc

2020-10-09 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

+1 This makes sense.

--

___
Python tracker 
<https://bugs.python.org/issue41974>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26680] Incorporating float.is_integer into Decimal

2020-10-08 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Thanks.  I'm hoping that this will easy now the most of the details have 
already been worked out.

--

___
Python tracker 
<https://bugs.python.org/issue26680>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23984] Documentation error: Descriptors

2020-10-08 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
stage: patch review -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue23984>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26680] Incorporating float.is_integer into Decimal

2020-10-07 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Applied the reversion and removed the "release blocker" designation.

When a new PR ready, we'll be more expeditious in getting reviewed.

--
priority: release blocker -> 
versions: +Python 3.10 -Python 3.9

___
Python tracker 
<https://bugs.python.org/issue26680>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26680] Incorporating float.is_integer into Decimal

2020-10-07 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset 4e0ce820586e93cfcefb16c2a3df8eaefc54cbca by Raymond Hettinger in 
branch 'master':
Revert "bpo-26680: Incorporate is_integer in all built-in and standard library 
numeric types (GH-6121)" (GH-22584)
https://github.com/python/cpython/commit/4e0ce820586e93cfcefb16c2a3df8eaefc54cbca


--

___
Python tracker 
<https://bugs.python.org/issue26680>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26680] Incorporating float.is_integer into Decimal

2020-10-06 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
pull_requests: +21577
stage: resolved -> patch review
pull_request: https://github.com/python/cpython/pull/22584

___
Python tracker 
<https://bugs.python.org/issue26680>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26680] Incorporating float.is_integer into Decimal

2020-10-06 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
title: Incorporating float.is_integer into the numeric tower and Decimal -> 
Incorporating float.is_integer into Decimal

___
Python tracker 
<https://bugs.python.org/issue26680>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26680] Incorporating float.is_integer into the numeric tower and Decimal

2020-10-06 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

No worries Robert.  It's all part of the process :-)

If it's okay with you.  I would like to revert the incorrectly applied PR and 
then you can build a fresh, clean patch.  Does that work for you?

--

___
Python tracker 
<https://bugs.python.org/issue26680>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26680] Incorporating float.is_integer into the numeric tower and Decimal

2020-10-05 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> I would have assumed that it's only making a promise that it 
> registers all the methods and properties marked *abstract* in
> the ABC. Do you have references to back up the stronger statement?

The isn't some weird or incidental promise.  It is the fundamental reason that 
abstract base classes exist at all (and not just in Python).

>From PEP 3119: "Each test carries with it a set of promises: it contains a 
>promise about the general behavior of the class, and a promise as to what 
>other class methods will be available."

>From PEP 3119: "In addition, the ABCs define a minimal set of methods that 
>establish the characteristic behavior of the type. Code that discriminates 
>objects based on their ABC type can trust that those methods will always be 
>present."

> we need to either (a) revert PR 6121 and then re-do the changes,
> without the changes to numbers.py, or (b) make a second PR to undo
> the numbers.py changes.

Given that (b) can't be done in the short-run, I recommend option (a) so that 
there is a single clean patch and to make sure this doesn't leak into a 
release.  The PR changed 19 files, so the longer we wait the harder it will be 
to revert cleanly.

--

___
Python tracker 
<https://bugs.python.org/issue26680>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41774] While removing element from list using for and remove(), which has same items output is not right

2020-10-04 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
assignee:  -> terry.reedy

___
Python tracker 
<https://bugs.python.org/issue41774>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41931] Make dict(object) return its attribute __dict__

2020-10-04 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Sorry, but I think there is a near zero chance that the language will be 
revised as you suggest. 

Marking this as closed. If you want to have more discussion, please take it to 
the python-ideas maillist.

--
resolution:  -> rejected
stage:  -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue41931>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26680] Incorporating float.is_integer into the numeric tower and Decimal

2020-10-04 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> How so?

When a concrete class registers with an ABC, it is making a promise that it 
implements everything in the ABC so that client code can count on all the 
methods being present.  That is the raison d'etre for abstract base classes.

In general, we restrict ABCs to a minimal useful subset of the capabilities of 
concrete classes.  That makes the ABC more broadly applicable and it makes life 
easier for implementers of concrete classes.  That's why collections.abc.Set 
doesn't include most of the named methods present in the concrete set/frozenset 
types.

Likewise, we don't want to add methods to already published ABCs because 
existing user classes registered to the ABC stop being compliant.  If an 
additional method is deemed essential, the technically correct way to do is to 
make a new ABC that subclasses from the old.  For example, that's why Python 2 
had to have both UserDict and IterableUserDict when we needed to add a 
__iter__() method.

--

___
Python tracker 
<https://bugs.python.org/issue26680>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41931] Make dict(object) return its attribute __dict__

2020-10-04 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

The vars() function already does this.

--
nosy: +rhettinger

___
Python tracker 
<https://bugs.python.org/issue41931>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26680] Incorporating float.is_integer into the numeric tower and Decimal

2020-10-04 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

>  it was added as a concrete method,

That still amounts to making it a requirement for all numeric classes, even 
ones that predate this patch.  So existing classes that are registered will no 
longer comply with the ABC.  

In general, it's hard to add methods to ABCs because an ABC makes a promise 
about what methods are available in any class registered to that ABC.

--

___
Python tracker 
<https://bugs.python.org/issue26680>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26680] Incorporating float.is_integer into the numeric tower and Decimal

2020-10-03 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Mark, why did this get merged with is_integer() still in the numeric tower?  I 
thought we had agreed not to do that.

--

___
Python tracker 
<https://bugs.python.org/issue26680>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41905] add update_abstractmethods function to update an ABC's abstract methods

2020-10-03 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> you're effectively proposing to compute (or update)
> __abstractmethods__ lazily.

Would it be possible to do the update whenever the class dictionary is 
modified, in PyType_Modified() perhaps (using logic similar to __mro__ 
updates__)?  

I not pushing for this; am just asking whether it is possible to make sure that 
__abstractmethods__ is always in sync with reality.

--

___
Python tracker 
<https://bugs.python.org/issue41905>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40348] Programming FAQ about "What is delegation?": Fix typos

2020-10-03 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue40348>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41905] add update_abstractmethods function to update an ABC's abstract methods

2020-10-03 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Guido, can the method update be made automatic?  When instantiation fails, 
recheck to see the missing abstract methods had been defined?

>>> from abc import *
>>> class P(ABC):
@abstractmethod
def m(self):
pass

>>> class C(P):
pass

>>> C.m = lambda self: None
>>> C()
Traceback (most recent call last):
  File "", line 1, in 
C()
TypeError: Can't instantiate abstract class C with abstract method m

The latter message doesn't make sense that it should occur at all.

Roughly, the existing instantiation logic is:

 if cls.__abstractmethods__:
 raise TypeError(f"TypeError: Can't instantiate abstract class
 {cls.__name} with abstract method {methname}")

Could that be changed to something like this:

 if cls.__abstractmethods__:
 for methname is cls.__abstractmethods__.copy():
 if getattr(cls, methname).__isabstractmethod__:
 raise TypeError(f"TypeError: Can't instantiate abstract class
  {cls.__name} with abstract method {methname}")
 cls.__abstractmethods__.remove(methname)

I haven't thought this through.  Was just thinking that it would nice to have 
automatic updates rather than transferring the responsibility outside of the 
core ABC logic.

--

___
Python tracker 
<https://bugs.python.org/issue41905>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41905] add update_abstractmethods function to update an ABC's abstract methods

2020-10-02 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> it's totally clear to me what @total_ordering should do 
> -- it should define __le__, __gt__ and __ge__ in terms 
> of __lt__, and leave __lt__ alone, for some subclass to 
> implement.

+1

--

___
Python tracker 
<https://bugs.python.org/issue41905>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41905] add update_abstractmethods function to update an ABC's abstract methods

2020-10-02 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> I'm going to ignore this issue until you two have reached agreement.
> I recommend using some example code.

That won't be necessary.  I now understand what the OP is trying to do and am 
going to recommend against it.  

Guido, this really a decision for you to make.  Formerly ABC logic existed 
independent of any other class logic.  Nothing else in the standard library or 
in third-party tooling was required to take it into account.  A developer could 
leave or take it if they pleased.

The OP is proposing much tighter coupling and interdependence.  Effectively, he 
wants two new general rules to apply pervasively to existing tooling that 
previously had no reason to interact with ABCs at all.

1) When checking to see if a method exists, perhaps by using hasattr(), it 
should exclude abstract methods as determined by a follow-up getattr() call.

2) If a tool dynamically adds a method, it has duty to call 
update_abstractmethods() if even a slim possibility exists that ABCs are being 
used.

Presumably, none of this is unique to the total_ordering() decorator and it 
would apply to anything that dynamically inspects or updates classes whether by 
direct call, by class decorator, or by metaclass.

My recommendation is to not go down this path.  In the particular case of 
total_ordering(), the value add is slightly above zero.  In the decade long 
history of ABCs and the total_ordering() decorator, the need for this has 
arisen zero times.

P.S.  In the standard library, only the numbers module has ABCs with abstract 
rich comparison methods.  Typically, these would be used by registering the ABC 
rather than by inheriting from it.  That may be one reason why this hasn't come 
up.

--

___
Python tracker 
<https://bugs.python.org/issue41905>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41905] add update_abstractmethods function to update an ABC's abstract methods

2020-10-02 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

You might be misunderstanding what @total_ordering does.  It can't be used by 
subclasses to override abstract methods.

>>> from abc import abstractmethod, ABC
>>> from functools import total_ordering

>>> class X(ABC):
@abstractmethod
def __lt__(self, other):
raise RuntimeError('abstract called')

>>> @total_ordering
class Y(X):
def __le__(self, other):
return True

>>> sorted(vars(Y))# note that __lt__ is missing and Y() won't instantiate
['__abstractmethods__', '__doc__', '__ge__', '__gt__', '__le__', '__module__', 
'_abc_impl']

--

___
Python tracker 
<https://bugs.python.org/issue41905>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41513] High accuracy math.hypot()

2020-10-01 Thread Raymond Hettinger


Change by Raymond Hettinger :


Added file: https://bugs.python.org/file49484/best_frac.py

___
Python tracker 
<https://bugs.python.org/issue41513>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41513] High accuracy math.hypot()

2020-10-01 Thread Raymond Hettinger


Change by Raymond Hettinger :


Removed file: https://bugs.python.org/file49435/best_frac.py

___
Python tracker 
<https://bugs.python.org/issue41513>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41905] add update_abstractmethods function to update an ABC's abstract methods

2020-10-01 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

The downside of this proposal is that it is tightly coupled with class creation 
process.  It requires all existing class decorators, metaclasses, and code 
generators to start caring about something that isn't part of their core 
functionality (very few tools are ABC aware).

I'm usually dubious about proposed solutions to problems that 1) rarely occur 
in practice and 2) require everyone else to change their code.

Am not sure why total_ordering was mentioned?  No current collections ABC 
requires the ordering methods and hand-rolled numeric classes typically don't 
use total_ordering because it is simpler, faster, and cleaner to implement the 
methods directly.

--

___
Python tracker 
<https://bugs.python.org/issue41905>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41905] add update_abstractmethods function to update an ABC's abstract methods

2020-10-01 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
nosy: +gvanrossum

___
Python tracker 
<https://bugs.python.org/issue41905>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41905] add update_abstractmethods function to update an ABC's abstract methods

2020-10-01 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
nosy: +rhettinger

___
Python tracker 
<https://bugs.python.org/issue41905>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41859] Uncaught ValueError

2020-09-30 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I don't have a reproducer.  The event occurred one in a full-day session.

I don't get a completion box.

--

___
Python tracker 
<https://bugs.python.org/issue41859>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36255] Provide a simple way to delete and edit python's welcome message

2020-09-30 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
stage:  -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue36255>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41887] ast.literal_eval does not accept strings with leading whitespaces

2020-09-30 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
nosy: +gvanrossum

___
Python tracker 
<https://bugs.python.org/issue41887>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41774] While removing element from list using for and remove(), which has same items output is not right

2020-09-29 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

> If space is not an issue, the list comprehension may be fastest.

I think there is still a misunderstanding here.  The generator variant does not 
save space.  It uses slightly *more* space than the list variant.

The list_ass_slice()¹ function runs PySequence_Fast² on its input.  If the 
input is already a list or tuple, it is returned immediately.  If not, the 
iterator is run to exhaustion and a new list is built.  Either way, when the 
actual update occurs, the source will be a list or tuple.

¹ https://github.com/rhettinger/cpython/blob/master/Objects/listobject.c#L597
² https://github.com/rhettinger/cpython/blob/master/Objects/abstract.c#L2014

--

___
Python tracker 
<https://bugs.python.org/issue41774>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41773] Clarify handling of infinity and nan in random.choices

2020-09-28 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Thanks for the PR and for filing the issue.

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue41773>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41773] Clarify handling of infinity and nan in random.choices

2020-09-28 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset b0dfc7581697f20385813582de7e92ba6ba0105f by Ram Rachum in branch 
'master':
bpo-41773: Raise exception for non-finite weights in random.choices().  
(GH-22441)
https://github.com/python/cpython/commit/b0dfc7581697f20385813582de7e92ba6ba0105f


--

___
Python tracker 
<https://bugs.python.org/issue41773>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40554] Add escape to the glossary?

2020-09-28 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

s/rely/read/

--

___
Python tracker 
<https://bugs.python.org/issue40554>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40554] Add escape to the glossary?

2020-09-28 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

For the reasons mentioned by Inada, I don't think this should be added.  

The term "escape" means many different things in different contexts.  To the 
extent the term needs to be defined, it should be done in the docs for those 
contexts (i.e. regular expression escapes should be talked about in the regex 
docs).

Side note:  It is not the purpose of the glossary to define every term in 
computer science.  The more fluff we add to the glossary, the harder it becomes 
to rely the glossary and learn Python specific terms.

--
nosy: +rhettinger

___
Python tracker 
<https://bugs.python.org/issue40554>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41877] Check against misspellings of assert etc. in mock

2020-09-28 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

Václav, I support your suggestion and suggest that you move forward to prepare 
a PR.

Vedran, this API has been set in stone for a long time, so changing is 
disruptive.  If you really think the API needs to be redesigned, consider 
bringing it up on python-ideas.  The proposal would need broad support to move 
forward.

--
nosy: +michael.foord, rhettinger

___
Python tracker 
<https://bugs.python.org/issue41877>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41773] Clarify handling of infinity and nan in random.choices

2020-09-28 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I've discussed this with other developers and now agree that a test should be 
added.  While the current code's handing of Inf or NaN is correct in a 
technical sense, it is neither intuitive or useful.

Even though it will have a small time cost for the common case of two weights, 
we should add a test just after the check for the total being greater than zero:

if not _isfinite(total):
raise ValueError('Total of weights must be finite')

Also edit the docs to say:

   Weights are assumed to be non-negative and finite.

Ram, since this was your finding, do you want to make a PR for it (with a test, 
news entry, and doc edit)?

--
resolution: not a bug -> 
status: closed -> open
type: behavior -> enhancement

___
Python tracker 
<https://bugs.python.org/issue41773>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41114] "TypeError: unhashable type" could often be more clear

2020-09-27 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> I've noticed that Python beginners tend to find this really confusing.

No minor tweak to the exception message will make this go away.  For 
understanding to occur, the only way to forward is to learn a bit about 
hashability.  That is a step that every beginner must take.

Fortunately, the term "hashable" is listed in the glossary.  Also the error 
message itself is easily Googled:

   https://docs.python.org/3/glossary.html#term-hashable

   
https://www.google.com/search?q=TypeError%3A+unhashable+type%3A+%27dict%27=TypeError%3A+unhashable+type%3A+%27dict%27

I suggest that you take this to the python-ideas list.  While there is a valid 
concern that a new user may not understand the error message (this is 
unfortunately true for many our error messages), the proposals don't actually 
improve the situation.

The first proposal adds hard-to-implement context information that still 
doesn't tell a user what the issue is.  The second proposal repeats information 
that is already being shown.  Neither proposal explains what is meant by 
unhashable type, why it matters, what would be an allowable hashable type, or 
how to fix the problem (which is what the user really wants to know).

After a discussion on python-ideas, if a better proposal is found, feel free to 
reopen this issue.

--
resolution:  -> rejected
stage:  -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue41114>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41865] doc search for super().__init__() returns no useful results

2020-09-27 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
stage:  -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue41865>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41114] "TypeError: unhashable type" could often be more clear

2020-09-27 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> Do you think it would help if the exception was of type UnhashableType

That would not add more information. The message already says "unhashable 
type".  Saying it twice doesn't help.

--

___
Python tracker 
<https://bugs.python.org/issue41114>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41114] "TypeError: unhashable type" could often be more clear

2020-09-26 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> It would be clearer if the message was something like:
> 
> TypeError: 'dict' can not be used as a set value because 
> it is an unhashable type.

IMO that doesn't help.  The trackback already shows the code where the 
exception occurred.  The user already knows the calling type, and the existing 
message tells them what type was passed in.  

Their real problem is that they still have to confront the notion of what 
"unhashable type" means and then need figure-out a way to fix it.  So the 
proposed extra information is just a distractor that doesn't get the user any 
closer to understanding or solving their problem.  

To get a user closer to the solution they would either need an explanation of 
what hashable means and/or be given a suggestion of how to fix it:

   TypeError: unhashable type: 'dict'.  Consider using an int,
   str, tuple, or frozenset.

That said, it is precarious to guess what the user intended, so it is difficult 
to suggest some form of "did you mean ..."

--
nosy: +rhettinger

___
Python tracker 
<https://bugs.python.org/issue41114>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36255] Provide a simple way to delete and edit python's welcome message

2020-09-26 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> I think this issue can be closed, there is nothing to do on it.

Right.

--
assignee:  -> rhettinger
nosy: +rhettinger
resolution:  -> not a bug

___
Python tracker 
<https://bugs.python.org/issue36255>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41865] doc search for super().__init__() returns no useful results

2020-09-26 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

The primary documentation for super() is here:
https://docs.python.org/3/library/functions.html#super

At the bottom it references a guide to using super() that you might find 
helpful:
https://rhettinger.wordpress.com/2011/05/26/super-considered-super/

The standard library source code has many examples.  In particular, the 
argparse module makes heavy use of super():
https://github.com/python/cpython/blob/3.8/Lib/argparse.py

The tutorial provides some light discussion:
https://docs.python.org/3/tutorial/classes.html#multiple-inheritance

There is also an FAQ entry:
https://docs.python.org/3/faq/programming.html#how-do-i-call-a-method-defined-in-a-base-class-from-a-derived-class-that-overrides-it

There is also extensive coverage on StackOverflow:
https://stackoverflow.com/search?q=%5Bpython%5D+super

Hope you find these links helpful.

--

___
Python tracker 
<https://bugs.python.org/issue41865>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41865] doc search for super().__init__() returns no useful results

2020-09-26 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

The __init__() method isn't a feature of super().  It is a feature of the class 
being called.

--
nosy: +rhettinger

___
Python tracker 
<https://bugs.python.org/issue41865>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39862] Why are the union relationships not implemented by default for ≤ and ≥?

2020-09-26 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

This issue is more of a question or objection than a bug report, so I'm going 
to mark this as closed.  

Feel free to continue the discussion on python-ideas or ask more about it on 
StackOverflow.

--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue39862>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41774] While removing element from list using for and remove(), which has same items output is not right

2020-09-25 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Sorry for the wording of the last message.  Go ahead with whatever you would 
like do :-) 

Was only trying to point-out that the generator semantics don't interact nicely 
with slice assignments:

$ python3.9 -m timeit -s 'a=list(range(1000))' 'b=a[:]' 'b[:]=(x for x in 
a)'
5000 loops, best of 5: 46.6 usec per loop

$ python3.9 -m timeit -s 'a=list(range(1000))' 'b=a[:]' 'b[:]=[x for x in 
a]'
1 loops, best of 5: 26.3 usec per loop

--

___
Python tracker 
<https://bugs.python.org/issue41774>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41859] Uncaught ValueError

2020-09-25 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> What python binary?

This is from the 64-bit macOS build on python.org:

$ python3.9
Python 3.9.0rc2 (v3.9.0rc2:2bd31b5fde, Sep 16 2020, 20:19:18)
[Clang 6.0 (clang-600.0.57)] on darwin

Thanks for looking into this :-)

Let me know if filing these issues is helpful to you.  I log a couple thousand 
hours of heavy IDLE usage each year and my students really put the tool through 
its paces.  We tend to uncover buglets that wouldn't surface in light testing.  
At the end of the day, if there are tracebacks I haven't seen before, I'm 
posting them here.  Hopefully, they are useful.

--

___
Python tracker 
<https://bugs.python.org/issue41859>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41774] While removing element from list using for and remove(), which has same items output is not right

2020-09-25 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> I like the simple ad easy 'slice replacement = iterator' form
>  because it illustrates to me that we have done something 
> right with Python's design.

I understand that you like it and that it reflects the way you think the world 
should work, , but that doesn't warrant putting it in the FAQ.  We should steer 
users down a path of feeding unsizable inputs into tooling that needs a size to 
work well (the receiving code either has to implicitly build a list first 
before it can start or it will have to have periodic resizes). A straight list 
comprehension will suffice to answer the question cleanly.

FWIW, the same issue occurs with str.join().  It works better with a list 
comprehension than an iterator.  Given an iterator, it has to build an internal 
list first before it can start.  That is slower than starting with a list in 
the first place and makes the memory consumption implicit when it should be 
explicit (a generator would create the illusion that a list isn't being formed 
which is misleading).

--

___
Python tracker 
<https://bugs.python.org/issue41774>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41860] random.choices() raises "int too large" error while random.randint does not

2020-09-25 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

This is a known limitation and there isn't much we can do about it. 

The root cause is that for performance reasons the len() function doesn't 
handle sizes larger than a C ssize_t:

>>> len(range(2**100))
Traceback (most recent call last):
... 
OverflowError: Python int too large to convert to C ssize_t

For the same reason, you would also see the same error for random.choice():

>>> random.choice(range(2**100))
Traceback (most recent call last):
... 
OverflowError: Python int too large to convert to C ssize_t

Given that we can't get the size of the population, there isn't much that 
choice() or choices() can do about the situation without special casing range 
objects and reconstructing what len() would have returned had it not been 
restricted.  Given that this hasn't seemed to have ever been a problem in 
practice, I recommend just using randrange() in a loop.

--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue41860>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41859] Uncaught ValueError

2020-09-24 Thread Raymond Hettinger


New submission from Raymond Hettinger :

I found this in today's long running shell session.  The trigger event isn't 
known.

Exception in Tkinter callback
Traceback (most recent call last):
  File 
"/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/tkinter/__init__.py",
 line 1885, in __call__
return self.func(*args)
  File 
"/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/idlelib/multicall.py",
 line 176, in handler
r = l[i](event)
  File 
"/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/idlelib/autocomplete_w.py",
 line 430, in keyrelease_event
self.hide_window()
  File 
"/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/idlelib/autocomplete_w.py",
 line 447, in hide_window
self.widget.event_delete(HIDE_VIRTUAL_EVENT_NAME, seq)
  File 
"/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/idlelib/multicall.py",
 line 392, in event_delete
triplets.remove(triplet)
ValueError: list.remove(x): x not in list

--
assignee: terry.reedy
components: IDLE
messages: 377479
nosy: rhettinger, terry.reedy
priority: normal
severity: normal
status: open
title: Uncaught ValueError
versions: Python 3.9

___
Python tracker 
<https://bugs.python.org/issue41859>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



  1   2   3   4   5   6   7   8   9   10   >