[Python-ideas] Are we supposed to be able to have our own class dictionary in python 3?

2018-11-03 Thread Joy Diamond
of it. Am I missing something? Is this supposed to work? Is the documentation wrong? Thanks, Joy Diamond. Program that shows that the class dictionary created is not what we pass in --- Shows the actual symbol table is `dict` not `SymbolTable` class SymbolTable(dict): pass members = Sy

Re: [Python-ideas] Add a way to test for a descriptor in Python Code

2018-10-30 Thread Joy Diamond
o/descriptor.html https://docs.python.org/3/howto/descriptor.html Both of which need to be updated. (This is not yet filed as a bug report; as first I am requesting a call to something like `_PyType_Lookup` that is efficent; and once we agree on that, we can created an updated reproduction of `type.__

[Python-ideas] Add a way to test for a descriptor in Python Code

2018-10-30 Thread Joy Diamond
is returned by `Point.y`, `type.__getattribute__(Point, y)`, and `fixed__Type__getattribute` 3. The invalid value of `Point.y` is `2` as returned by the [emulated] `__getattribute__` documented https://docs.python.org/3/howto/descriptor.html So I am requesting: 1. An efficient python way t

Re: [Python-ideas] Decide if `type.__subclasses__` is part of future Python or not

2018-10-29 Thread Joy Diamond
20:11, Joy Diamond пише: > > Currently `type.__subclasses__` is not documented at docs.python.org > > <http://docs.python.org> (and works in both python 2 & python 3). > > > > I would like to keep `.__subclasses__` and have it documented at > > docs.pyth

Re: [Python-ideas] Decide if `type.__subclasses__` is part of future Python or not

2018-10-29 Thread Joy Diamond
l static type checking, and yes, this will > occasionally result in changed recommendations for how the language should > be used or how APIs should be designed, but no, this does not mean that > we're planning to deprecate or remove existing runtime features. > > On Mon, Oc

[Python-ideas] Decide if `type.__subclasses__` is part of future Python or not

2018-10-29 Thread Joy Diamond
ocumented. Thanks, Joy Diamond. 1. The google search: "site:docs.python.org __subclasses__" finds no instances of the word "__subclasses__" 2. As for what the function does, it returns the subclasses of a class: Consider the following program: class Cryptog

Re: [Python-ideas] Fix documentation for __instancecheck__

2018-10-27 Thread Joy Diamond
On Sat, Oct 27, 2018 at 10:00 PM Chris Angelico wrote: > On Sun, Oct 28, 2018 at 12:53 PM Joy Diamond wrote: > >> - type(x) and x.__class__ don't necessarily agree; under what > >> circumstances are each used? > >> > >> (I've asked this befor

Re: [Python-ideas] Fix documentation for __instancecheck__

2018-10-27 Thread Joy Diamond
On Sat, Oct 27, 2018 at 8:02 PM Steven D'Aprano wrote: > I don't think it is obvious that the behaviour is correct. Presumably > Joy had a use-case for overriding isinstance(), and this optimization > prevented it. > > Joy, can you comment on your use-case, and did you come up with a > work-aroun

Re: [Python-ideas] Fix documentation for __instancecheck__

2018-10-27 Thread Joy Diamond
Thanks, Terry. As per your suggestion, I have submitted it as a bug report to: https://bugs.python.org/issue35083 On Sat, Oct 27, 2018 at 4:09 PM Terry Reedy wrote: > On 10/27/2018 2:53 PM, Joy Diamond wrote: > > Chris, > > > > Yes, the following works: > > "&qu

Re: [Python-ideas] Fix documentation for __instancecheck__

2018-10-27 Thread Joy Diamond
e(x)`. For example the actual code reference above: https://github.com/python/cpython/blob/master/Objects/abstract.c#L2397-L2405 Says "if (Py_TYPE(inst) == (PyTypeObject *)cls)" in the actual C Python implementation: So it using `type(x)` not `x.__class__` Thanks, Joy Diamond. A

[Python-ideas] Fix documentation for __instancecheck__

2018-10-27 Thread Joy Diamond
simple code above ... One of the best things about python is how accurate and consistent the documentation is. This request is to keep these high standards. Thanks, Joy Diamond. NOTE: I'm not sure where to post this, so posting to python-ideas, in case people want to discuss getting rid of