My question is very straight forward: Is smtplib pure python or implemented in C?
+3
A:
smtplib itself is implemented in python but socket is based on C, so its means both.
S.Mark
2009-11-26 02:43:22
Thanks Mark! That's what I was looking for.
Viet
2009-11-26 02:45:57
+1
A:
Basically pure Python (as the underlying implementation if you go down far enough is C). You can find the source under the Lib\ directory in your Python root.
Wayne Koorts
2009-11-26 02:44:26
thanks Wayne! I gave both answers +1 and thank you very much for participation. Since Mark arrived first, I give him the green mark. Thank you very much!
Viet
2009-11-26 02:47:01
+6
A:
In [32]: import smtplib
In [33]: smtplib
Out[33]: <module 'smtplib' from '/usr/lib/python2.6/smtplib.pyc'>
Therefore, smtplib is written in python.
unutbu
2009-11-26 02:44:35
Not to be picky, but this wouldn't detect if smtplib is using a helper module (as part of the library) that is a native.
notnoop
2009-11-26 03:11:56
@notnoop: That's true, but since every Python implementation (other than PyPy) is written in another language, every module depends on something which is non-Python if you dig deep enough. Therefore I interpreted the question to mean, "Is the module itself written in Python?"
unutbu
2009-11-26 03:24:22
Well, there are a few modules whose Python module part is but a slim wrapper with a extra functions over the main implementation part from a _module C implementation.
bobince
2009-11-26 12:11:35