Gabriel Genellina wrote:
En Fri, 13 Feb 2009 08:43:03 -0200, Peter Otten <__pete...@web.de>
escribió:
class Type(type):
... def __instancecheck__(self, other): return True
...
class A(metaclass=Type): pass
...
class B: pass
...
isinstance(B(), A)
True
See also
http://www.python.or
En Fri, 13 Feb 2009 08:43:03 -0200, Peter Otten <__pete...@web.de>
escribió:
Gabriel Genellina wrote:
En Fri, 13 Feb 2009 08:07:58 -0200, Carl Banks
escribió:
But that brings up another very slight possibility, though not a very
likely one in this case: the behavior of isinstance can be
cus
Gabriel Genellina wrote:
> En Fri, 13 Feb 2009 08:07:58 -0200, Carl Banks
> escribió:
>
>> Well, the OP said he was using Python 3.0, where all classes are new-
>> style classes.
>>
>> But that brings up another very slight possibility, though not a very
>> likely one in this case: the behavior
En Fri, 13 Feb 2009 08:07:58 -0200, Carl Banks
escribió:
Well, the OP said he was using Python 3.0, where all classes are new-
style classes.
But that brings up another very slight possibility, though not a very
likely one in this case: the behavior of isinstance can be
customized. It can h
On Feb 12, 10:49 am, redbaron wrote:
> Don't really sure, but try to define your class as new-style one.
> Like
> class GeoMap(object):
> ...
Well, the OP said he was using Python 3.0, where all classes are new-
style classes.
But that brings up another very slight possibility, though not a v
maksym.ka...@gmail.com a écrit :
Hi there.
now i'm a complete newbie for python, and maybe my problem is stupid
but i cannot solve it myself
Others already addressed your problem (cf Paul and Diez answers). I'll
just allow myself to point a couple other potential problems with your code:
#
redbaron a écrit :
Don't really sure, but try to define your class as new-style one.
isinstance() works as well with classic classes.
--
http://mail.python.org/mailman/listinfo/python-list
maksym.ka...@gmail.com schrieb:
Hi there.
now i'm a complete newbie for python, and maybe my problem is stupid
but i cannot solve it myself
i have an object of class GeoMap which contains lists with objects of
GeoMapCell (i will not explain what they should do, hope its not
important). Then i wa
On Feb 12, 12:26 pm, maksym.ka...@gmail.com wrote:
>
> Well the output of
>
> > print(type(obj))
> > print(str(obj))
>
> was
>
>
>
>
> Just looks well, isn't it? i have no idea what's wrong
So then how do you know isinstance is evaluating to False? And why do
you return None if it evals to True
On 12 фев, 21:49, redbaron wrote:
> Don't really sure, but try to define your class as new-style one.
> Like
> class GeoMap(object):
> ...
Sorry, it didn't work
--
http://mail.python.org/mailman/listinfo/python-list
Don't really sure, but try to define your class as new-style one.
Like
class GeoMap(object):
...
--
http://mail.python.org/mailman/listinfo/python-list
> Here's a crazy idea out of left field. Just before calling
> isinstance, why not try:
>
> print(type(obj))
> print(str(obj))
>
> This may illuminate the unexpected behavior, you'll find out just what
> obj has in it.
>
> -- Paul
Well the output of
> print(type(obj))
> print(str(obj))
was
J
On Feb 12, 11:53 am, maksym.ka...@gmail.com wrote:
> Hi there.
> now i'm a complete newbie for python, and maybe my problem is stupid
> but i cannot solve it myself
>
> i have an object of class GeoMap which contains lists with objects of
> GeoMapCell (i will not explain what they should do, hope i
13 matches
Mail list logo