
So this one kind of is screaming at me: socket -> socket.__init__ SocketServer -> socket.server ssl -> socket.ssl I know Guido has expressed his dislike of putting much code in a package's __init__, but since every module that would go in this package is dependent on the socket module anyway, I see no harm. What do people think? -Brett

On 09/03/2008, at 19:15, Brett Cannon wrote:
So this one kind of is screaming at me:
socket -> socket.__init__ SocketServer -> socket.server ssl -> socket.ssl
I know Guido has expressed his dislike of putting much code in a package's __init__, but since every module that would go in this package is dependent on the socket module anyway, I see no harm.
I think this would be better: socket -> socket.socket and maybe in the __init__ it could call socket.socket and expose things to a client so he only needs to import socket. -- Leonardo Santagada

On Sun, Mar 9, 2008 at 4:53 PM, Fred Drake <fdrake@acm.org> wrote:
On Mar 9, 2008, at 7:25 PM, Leonardo Santagada wrote:
I think this would be better:
socket -> socket.socket
With this modification, +1 on this proposal.
Problem with that is it goes against name simplification; 'socket.socket' is not as simple as 'socket'. So why do the two of you think this is better than just importing 'socket'? -Brett

On Mar 9, 2008, at 8:13 PM, Brett Cannon wrote:
Problem with that is it goes against name simplification; 'socket.socket' is not as simple as 'socket'. So why do the two of you think this is better than just importing 'socket'?
With the proposal, you still just import socket, but the implementation for the names in socket is in socket.socket. The motivation is more of a pattern that I've seen work well in practice: __init__.py is pretty minimal, and the implementations are all in "normal" modules with package.module names. The real advantage is that all real code is in a file with a descriptive name; __init__ doesn't describe package contents, but package initialization. -Fred -- Fred Drake <fdrake at acm.org>

On Sun, Mar 9, 2008 at 4:46 PM, Antoine Pitrou <solipsis@pitrou.net> wrote:
Le dimanche 09 mars 2008 à 15:15 -0700, Brett Cannon a écrit :
So this one kind of is screaming at me:
socket -> socket.__init__ SocketServer -> socket.server ssl -> socket.ssl
If there are different kinds of sockets in it, perhaps the package should be named "sockets" instead?
Eh, I don't see a benefit in making it plural. And isn't it traditionally called the socket library, even under C? -Brett

On Sun, Mar 9, 2008 at 6:15 PM, Brett Cannon <brett@python.org> wrote:
So this one kind of is screaming at me:
socket -> socket.__init__ SocketServer -> socket.server ssl -> socket.ssl
I know Guido has expressed his dislike of putting much code in a package's __init__, but since every module that would go in this package is dependent on the socket module anyway, I see no harm.
What do people think?
I like it. Also, I think it make sense to put socket's code in socket.__init__. Doing otherwise, would be redundant for the users. Imagine: import socket.socket s = socket.socket.socket(socket.socket.AF_INET, socket.socket.SOCK_STREAM) Ugh! (Of course, you could do use a from-import, to avoid this) -- Alexandre

On Sun, Mar 9, 2008 at 5:50 PM, Alexandre Vassalotti <alexandre@peadrop.com> wrote:
On Sun, Mar 9, 2008 at 6:15 PM, Brett Cannon <brett@python.org> wrote:
So this one kind of is screaming at me:
socket -> socket.__init__ SocketServer -> socket.server ssl -> socket.ssl
I know Guido has expressed his dislike of putting much code in a package's __init__, but since every module that would go in this package is dependent on the socket module anyway, I see no harm.
What do people think?
I like it. Also, I think it make sense to put socket's code in socket.__init__. Doing otherwise, would be redundant for the users. Imagine:
import socket.socket s = socket.socket.socket(socket.socket.AF_INET, socket.socket.SOCK_STREAM)
Ugh! (Of course, you could do use a from-import, to avoid this)
I think that is the currently running argument, which is valid. Fred's comment about reserving package initialization instead of contents for __init__ makes sense. Question is whether Guido will go for this. =) And do we care about asyncore and asynchat? I figured they should stay out. -Brett
participants (6)
-
Alexandre Vassalotti
-
Antoine Pitrou
-
Bill Janssen
-
Brett Cannon
-
Fred Drake
-
Leonardo Santagada