Menu

#2 code cleanup

closed
nobody
None
2
2012-09-29
2007-08-18
Tavernier
No

Hello,

Is it possible to replace the lambda functions in irclib.py (line 221 if i remember well) by something more readable ? the lambda functions will be deprecated in next versions of python.

Thanks.

Discussion

  • Cygfrydd Llewellyn

    I don't see why not. Perhaps something like this?

    def process_once(self, timeout=0):
        need_sleep = True
        for connection in self.connections :
            if connection._get_socket() != None :
                need_sleep = False
                i, o, e = select.select(sockets, [], [], timeout)
                self.process_data(i)
        if need_sleep :
            time.sleep(timeout)
        self.process_timeout()
    
     
  • Cygfrydd Llewellyn

    Yikes... that sucked out all my indenting. Well, you get the idea.

     
  • Nobody/Anonymous

    how about replace the two initial lines,

    sockets = map(...)
    sockets = filter(...)

    with:

    sockets = [conn.get_socket() for conn in self.connections if conn.get_socket() != None]

     
  • Jason R. Coombs

    Jason R. Coombs - 2012-09-29
    • status: open --> closed
    • milestone: --> Next_Release_(example)
     
  • Jason R. Coombs

    Jason R. Coombs - 2012-09-29

    These are good suggestions, and as the code evolves, I will consider improvements such as these.

     

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.