Losing words

Roel Schroeven roel at roelschroeven.net
Mon Apr 1 14:09:01 EDT 2019


John Doe schreef op 1/04/2019 om 19:16:
> On 2019-04-01, Joel Goldstick <joel.goldstick at gmail.com> wrote:
>>>
>>> def text():
>>>      mess = input("> ")
>>>      s.send(bytes("PRIVMSG " + " "+ channel + " " +  mess  + "\n", "UTF-8"))
>>>
>>>      text()
>>>
>>
>> Is this a typo or are you calling text() from within text()?
>>>
> Indeed I do :-)
> I was thinking on another way but nothing came up to me but guess what?
> It works. What else I could do?

This is what 'while' is made for:

def text():
     while True:
         mess = input("> ")
         s.send(bytes("PRIVMSG " + " "+ channel + " " +  mess  + "\n", 
"UTF-8"))


The recursive solution you used works at first but stops working with 
RecursionError when the maximum recursion depth is exceeded.


-- 
"Honest criticism is hard to take, particularly from a relative, a
friend, an acquaintance, or a stranger."
         -- Franklin P. Jones

Roel Schroeven




More information about the Python-list mailing list