Re: evaluation question

2023-02-07 Thread Rob Cliffe via Python-list
On 07/02/2023 08:15, Chris Angelico wrote: On Tue, 7 Feb 2023 at 18:49, Rob Cliffe via Python-list wrote: On 02/02/2023 09:31, mutt...@dastardlyhq.com wrote: On Wed, 1 Feb 2023 18:28:04 +0100 "Peter J. Holzer" wrote: --b2nljkb3mdefsdhx Content-Type: text/plain; charset=us-ascii Content-

Re: Question about logging.config.dictConfig

2023-02-07 Thread Peter J. Holzer
On 2023-02-07 17:58:26 -0500, Ivan "Rambius" Ivanov wrote: > I am trying to configure my loggers using dictConfig, but they do not > print anything. Here are more details. [...] > from myloggingconf import configure_logging > > logger = logging.getLogger(os.path.basename(__file__)) [...] > > def

Re: A Function's name during its definition

2023-02-07 Thread Chris Angelico
On Wed, 8 Feb 2023 at 10:18, Mark Bourne wrote: > > Stefan Ram wrote: > > Mark Bourne writes: > >> In the second case, eval() only gets the globals and immediate locals, > > > >Yes, I think you are right. Curiously, the following program would > >mislead one to thing that eval /does/ see

Re: A Function's name during its definition

2023-02-07 Thread Mark Bourne
Stefan Ram wrote: Mark Bourne writes: In the second case, eval() only gets the globals and immediate locals, Yes, I think you are right. Curiously, the following program would mislead one to thing that eval /does/ see the intermediate names: main.py def f(): x = 22 def g(

Question about logging.config.dictConfig

2023-02-07 Thread Ivan "Rambius" Ivanov
Hello, I am trying to configure my loggers using dictConfig, but they do not print anything. Here are more details. I have several python scripts that use a similar logging setup. I put the common configuration in a separate module myloggingconf.py: # myloggingconf.py import logging def configu

Re: Tool that can document private inner class?

2023-02-07 Thread Ian Pilcher
On 2/7/23 14:53, Weatherby,Gerard wrote: Yes. Inspect module import inspect class Mine: def __init__(self): self.__value = 7 def __getvalue(self): /"""Gets seven""" /return self.__value mine = Mine() data = inspect.getdoc(mine) for m in inspect.getmembers(mine): if '__getvalue' in m[0]:

Re: Tool that can document private inner class?

2023-02-07 Thread Weatherby,Gerard
Yes. Inspect module import inspect class Mine: def __init__(self): self.__value = 7 def __getvalue(self): """Gets seven""" return self.__value mine = Mine() data = inspect.getdoc(mine) for m in inspect.getmembers(mine): if '__getvalue' in m[0]: d

Re: A Function's name during its definition

2023-02-07 Thread Mark Bourne
Stefan Ram wrote: When one defines a function, sometimes its name is only half-existent. One can implicitly evaluate the name of the function: main.py def g(): def f(): print( f ) f() g() output .f at ... , but one gets an error when one tries to evaluate

Tool that can document private inner class?

2023-02-07 Thread Ian Pilcher
I've been banging my head on Sphinx for a couple of days now, trying to get it to include the docstrings of a private (name starts with two underscores) inner class. All I've managed to do is convince myself that it really can't do it. See https://github.com/sphinx-doc/sphinx/issues/11181. Is t

Re: Evaluation of variable as f-string

2023-02-07 Thread Chris Angelico
On Wed, 8 Feb 2023 at 05:30, Stefan Ram wrote: > > Rob Cliffe writes: > >Does that mean that it is not possible to have a (built-in) function > >that would construct and return a dictionary of all available variables > >and their values? If it were possible, it could be useful, and there > >woul

Re: Evaluation of variable as f-string

2023-02-07 Thread Chris Angelico
On Wed, 8 Feb 2023 at 02:12, Rob Cliffe wrote: > > [re-sending this to both the list and to Chris, as a prior send to the > list only was bounced back] > On 31/01/2023 22:33, Chris Angelico wrote: > > > >> Thanks for clarifying. > >> Hm. So 'x' is neither in locals() nor in globals(). Which star

Re: Evaluation of variable as f-string

2023-02-07 Thread Rob Cliffe via Python-list
[re-sending this to both the list and to Chris, as a prior send to the list only was bounced back] On 31/01/2023 22:33, Chris Angelico wrote: Thanks for clarifying. Hm. So 'x' is neither in locals() nor in globals(). Which starts me wondering (to go off on a tangent): Should there be a nonlo

Re: evaluation question

2023-02-07 Thread Chris Angelico
On Tue, 7 Feb 2023 at 18:49, Rob Cliffe via Python-list wrote: > > > > On 02/02/2023 09:31, mutt...@dastardlyhq.com wrote: > > On Wed, 1 Feb 2023 18:28:04 +0100 > > "Peter J. Holzer" wrote: > >> --b2nljkb3mdefsdhx > >> Content-Type: text/plain; charset=us-ascii > >> Content-Disposition: inline >