[Twisted-Python] Re: [Twisted-commits] *With() methods; refactor/rearrangement of various internal classes

Andrew Bennetts andrew-twisted at puzzling.org
Fri Jan 31 00:30:06 MST 2003


On Fri, Jan 31, 2003 at 12:54:57AM -0600, Glyph Lefkowitz wrote:
> On Fri, 31 Jan 2003 17:23:24 +1100, Andrew Bennetts <andrew-twisted at puzzling.org> wrote:
> > > +        if isinstance(port, types.StringTypes):
> >                                ^^^^^^^^^^^^^^^^^ This breaks Python 2.1
> > 
> > Should tcp.py import t.p.compat (ugh)?
> 
> I think not.  This has been the recommended style for a while.
> 
>     Python 2.1.3 (#1, Jan  3 2003, 13:08:57) 
>     [GCC 2.95.4 20011002 (Debian prerelease)] on linux2
>     Type "copyright", "credits" or "license" for more information.
>     >>> import types
>     >>> isinstance(1, types.StringType)
>     0
>     >>> isinstance(1, types.IntType)
>     1

Yes, but now try types.StringType*s*, as used in the code.

-Andrew.





More information about the Twisted-Python mailing list