[PATCH RFC] batching: new module to support batching of commands
Michael Tharp
gxti at partiallystapled.com
Thu Jun 2 14:51:43 CDT 2011
On 06/02/2011 02:12 PM, Augie Fackler wrote:
> In 2.7:
>
>>>> class foo:
> ... pass
> ...
>>>> isinstance(foo(), object)
> True
>
> ISTR this changed a while ago, perhaps as long ago as 2.4, but I can't
> find the doc right now and don't have 2.4 handy to test.
This isn't telling you that "foo" is a new-style class but rather
answering a different question entirely:
>>> class foo: pass
...
>>> type(foo)
<type 'classobj'>
>>> issubclass(type(foo), object)
True
>>> type(foo())
<type 'instance'>
>>> issubclass(type(foo()), object)
True
"classobj" is the type of all old-style classes, and "instance" is the
type of all old-style instances, and both of these are derived from
"object" just like every other builtin type since (I think) 2.4. They
are not, however, indicative of a new-style class which is itself a
type, not merely an instance of a type:
>>> class foo2(object): pass
...
>>> type(foo2)
<type 'type'>
Thus concludes our Python guts lesson for today. Study well, there
*will* be a quiz.
-- m. tharp
More information about the Mercurial-devel
mailing list