[Python-Dev] Re: cmd.Cmd.prompt should be an instance attribute

2021-06-26 Thread Daniel Walker
Thank you On Sat, Jun 26, 2021 at 8:10 PM Guido van Rossum wrote: > Okay, then Chris Barker’s explanation applies. > > On Sat, Jun 26, 2021 at 16:35 Daniel Walker wrote: > >> I wasn't looking at the type stub but cmd.py itself. It has >> >> PROMPT = '

[Python-Dev] Re: cmd.Cmd.prompt should be an instance attribute

2021-06-26 Thread Daniel Walker
Found the mypy bug: https://github.com/python/mypy/issues/4125 On Sat, Jun 26, 2021 at 7:35 PM Daniel Walker wrote: > I wasn't looking at the type stub but cmd.py itself. It has > > PROMPT = '(Cmd) ' > ... > > class Cmd: > prompt = PROMPT > ... > > O

[Python-Dev] Re: cmd.Cmd.prompt should be an instance attribute

2021-06-26 Thread Daniel Walker
I wasn't looking at the type stub but cmd.py itself. It has PROMPT = '(Cmd) ' ... class Cmd: prompt = PROMPT ... On Sat, Jun 26, 2021 at 6:04 PM Guido van Rossum wrote: > On Sat, Jun 26, 2021 at 9:25 AM Daniel Walker wrote: > >> I was recently using the cmd module f

[Python-Dev] Re: cmd.Cmd.prompt should be an instance attribute

2021-06-26 Thread Daniel Walker
Sorry, that implementation should have been class Cmd: PROMPT = '> ' @property def prompt(self) -> str: return self.PROMPT ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to

[Python-Dev] cmd.Cmd.prompt should be an instance attribute

2021-06-26 Thread Daniel Walker
I was recently using the cmd module for a project where my CLI could connect to and interact with another host. I implemented prompt in such a way that it would show the IP address when connected. I.e., class MyCmd(cmd.Cmd): ... @property def prompt(self) -> str: if