question about class vs class at

Arnaud Delobelle arnodel at googlemail.com
Sun Apr 26 23:07:14 CEST 2009


grocery_stocker <cdalten at gmail.com> writes:

> When I do pexpect.spawn in the following example, I see <class
> 'pexpect.spawn'>
>
> [cdalten at localhost oakland]$ python
> Python 2.4.3 (#1, Oct  1 2006, 18:00:19)
> [GCC 4.1.1 20060928 (Red Hat 4.1.1-28)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import pexpect
>>>> pexpect.spawn
> <class 'pexpect.spawn'>
>>>>
>
> But now, when I do telnetlib.Telnet, I see <class telnetlib.Telnet at
> 0xb7eded1c>
>>>> import telnetlib
>>>> telnetlib.Telnet
> <class telnetlib.Telnet at 0xb7eded1c>
>>>>
>
> Why do I see <class telnetlib.Telnet at 0xb7eded1c> for
> telnetlib.Telnet, but I don't see the same for  <class
> 'pexpect.spawn'>? Ie, how come I don't see  <class 'pexpect.spawn' at
> 0xb7eded1c> ?

Because pexpect.spawn is a new-style class whereas telnetlib.Telnet is
an old-style class?

-- 
Arnaud



More information about the Python-list mailing list