[Tutor] Is socket.socket() a func or a class

Alan Gauld alan.gauld at btinternet.com
Fri Apr 6 09:41:04 CEST 2012


On 06/04/12 07:10, Khalid Al-Ghamdi wrote:

> I'm reading this book that says when creating a socket you have to use
> the socket.socket() _function _as in :
...
>  >>> type(ss)
> <class 'socket.socket'>
>
> so, which is it? or do authors loosely use these terms interchangeably
> in this context?

It just looks like sloppy terminology to me.

 >>> import socket as s
 >>> s.socket
<class 'socket._socketobject'>
 >>> s.gethostbyname
<built-in function gethostbyname>

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/



More information about the Tutor mailing list