Re: Get __name__ in C extension module

2019-10-06 Thread MRAB
On 2019-10-07 00:38, Ian Pilcher wrote: On 10/6/19 11:55 AM, MRAB wrote: > Don't you already have the module's name? You have to specify it in the > PyModuleDef struct that you pass to PyModule_Create. I do. Perhaps I'm trying to be too Pythonic, but there's so much advice out there about usi

Re: Get __name__ in C extension module

2019-10-06 Thread Ian Pilcher
On 10/6/19 12:55 PM, Barry Scott wrote: Then the answer to your question is simple. Do it in python and passt logger into the C++ module. Funny thing, that's exactly where I started this journey. I couldn't figure out how to get the logging.Logger type object, so that I could use a "O!" format

Re: Get __name__ in C extension module

2019-10-06 Thread Ian Pilcher
On 10/6/19 11:55 AM, MRAB wrote: Don't you already have the module's name? You have to specify it in the PyModuleDef struct that you pass to PyModule_Create. I do. Perhaps I'm trying to be too Pythonic, but there's so much advice out there about using getLogger(__name__) in Python code, rather

Mouse control

2019-10-06 Thread Alexander Vergun
Hello all, I am coding a voice assistant under Python 3.7, Windows 7. I am using PYcharm and libraries such as PYSimpleGUI, mouse, keyboard etc.  Everything works except for the mouse control and probably keyboard, the problem is following, when I run the script under PYcharm, the script can

Strange tab completion oddity with enums?

2019-10-06 Thread Chris Angelico
I'm not sure what's going on here, and it's probably not actually enum-specific, but that's where I saw it. If you create a plain class and have an attribute with an annotation, you can see that: >>> class Foo: ... spam: "ham" = 1 ... >>> Foo.__a Foo.__abstractmethods__ Foo.__annotations__ >

Re: Get __name__ in C extension module

2019-10-06 Thread Barry Scott
> On 5 Oct 2019, at 18:55, Ian Pilcher wrote: > > On 10/4/19 4:30 PM, Ian Pilcher wrote: >> Ideally, I would pass my existing Logging.logger object into my C >> function and use PyObject_CallMethod to call the appropriate method on >> it (info, debug, etc.). > > As I've researched this furthe

Anyone has good understanding of how model base agents work in 2D array? --AIMA repository

2019-10-06 Thread krishna singh
Hi, I have started learning artificial intelligence and currently going through AIMA repository https://github.com/aimacode/aima-python but I am stucked at model base reflex agent implementation in the 2D environment. Does anyone have a good understanding of how model base agents work in 2D arr

Re: Get __name__ in C extension module

2019-10-06 Thread MRAB
On 2019-10-06 15:48, Ian Pilcher wrote: On 10/5/19 12:55 PM, Ian Pilcher wrote: This is straightforward, except that I cannot figure out how to retrieve the __name__. Making progress. I can get a __name__ value with: PyDict_GetItemString(PyEval_GetGlobals(), "__name__") I say "a __name_

Re: Get __name__ in C extension module

2019-10-06 Thread Ian Pilcher
On 10/5/19 12:55 PM, Ian Pilcher wrote: This is straightforward, except that I cannot figure out how to retrieve the __name__. Making progress. I can get a __name__ value with: PyDict_GetItemString(PyEval_GetGlobals(), "__name__") I say "a __name__ value" because the returned value is actu