osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Losing words


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