Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #35251

Re: Strange effect with import

From jt@toerring.de (Jens Thoms Toerring)
Newsgroups comp.lang.python
Subject Re: Strange effect with import
Date 2012-12-21 01:12 +0000
Organization Freie Universitaet Berlin
Message-ID <ajhrbhFht4dU1@mid.uni-berlin.de> (permalink)
References <ajhbbnFe4q1U1@mid.uni-berlin.de> <50d38d78$0$29967$c3e8da3$5496439d@news.astraweb.com> <ajhj58Ffv64U1@mid.uni-berlin.de> <mailman.1124.1356051272.29569.python-list@python.org>

Show all headers | View raw


Terry Reedy <tjreedy@udel.edu> wrote:
> >   server = SocketServer.TCPServer((192.168.1.10, 12345), ReqHandler)
> >
> > where ReqHandler is the name of a class derived from
> > SocketServer.BaseRequestHandler

> You misunderstood the doc. You pass the class, not the name of the class.
>  From 21.19.4.1. socketserver.TCPServer Example
>      server = socketserver.TCPServer((HOST, PORT), MyTCPHandler)

Yes, I meant "the class", but I'm a bit weak on nomenclature in
Python;-)

> > A new instance of this class is gernerated for each connection
> > request to the server. In the call that creates the server I can
> > only specify the name of the class but no arguments to be passed

> Code those arguments directly into the handle method of your version of 
> MyTCPhandler. Or if you need to override multiple methods and use the 
> same values in multiple methods, override __init__ and add self.x = 
> x-value statements.

Sorry, you lost me there: what means "code those arguments
directly into the handle method"? According to the documen-
tation (or at least to my understanding of it;-) the handle()
method is suppose to accept just one argument, 'self'. And
even if I would change the method to accept more arguments
and that wouldnt blow up into my face, where would they be
coming from (and from where would I pass them)?

                           Best regards, Jens
-- 
  \   Jens Thoms Toerring  ___      jt@toerring.de
   \__________________________      http://toerring.de

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Strange effect with import jt@toerring.de (Jens Thoms Toerring) - 2012-12-20 20:39 +0000
  Re: Strange effect with import Dave Angel <d@davea.name> - 2012-12-20 15:59 -0500
  Re: Strange effect with import Peter Otten <__peter__@web.de> - 2012-12-20 22:11 +0100
  Re: Strange effect with import Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-12-20 22:13 +0000
    Re: Strange effect with import jt@toerring.de (Jens Thoms Toerring) - 2012-12-20 22:52 +0000
      Re: Strange effect with import Terry Reedy <tjreedy@udel.edu> - 2012-12-20 19:54 -0500
        Re: Strange effect with import jt@toerring.de (Jens Thoms Toerring) - 2012-12-21 01:12 +0000
      Re: Strange effect with import Hans Mulder <hansmu@xs4all.nl> - 2012-12-21 01:54 +0100
        Re: Strange effect with import jt@toerring.de (Jens Thoms Toerring) - 2012-12-21 01:25 +0000
        Re: Strange effect with import jt@toerring.de (Jens Thoms Toerring) - 2012-12-21 15:52 +0000

csiph-web