I have a vague feeling this may have been discussed a long time ago, but
I can't find the thread, so I'll bring it up again.
I recently observed in the checking if a list is empty thread that a
list and a subclass of list can compare equal:
class MyList(list
On Thursday 12 May 2011 22:23:04 Roy Smith wrote:
I have a vague feeling this may have been discussed a long
time ago, but I can't find the thread, so I'll bring it up
again.
I recently observed in the checking if a list is empty
thread that a list and a subclass of list can compare equal
On Thu, May 12, 2011 at 6:23 AM, Roy Smith r...@panix.com wrote:
I have a vague feeling this may have been discussed a long time ago, but
I can't find the thread, so I'll bring it up again.
I recently observed in the checking if a list is empty thread that a
list and a subclass of list can
On May 12, 2011, at 11:30 AM, Eric Snow wrote:
On Thu, May 12, 2011 at 6:23 AM, Roy Smith r...@panix.com wrote:
The docs say:
[http://docs.python.org/library/stdtypes.html]
Objects of different types, except different numeric types and different
string types, never compare equal
Roy Smith wrote:
I recently observed in the checking if a list is empty thread that a
list and a subclass of list can compare equal:
class MyList(list):
I'm a subclass
l1 = []
l2 = MyList()
print type(l1), type(l2)
print type(l1) == type(l2)
print l1 == l2
Roy Smith wrote:
On May 12, 2011, at 11:30 AM, Eric Snow wrote:
That definitely makes it unclear.
I don't think it's unclear at all. It's very clear. Clearly wrong :-)
While it is wrong (it should have 'built-in' precede the word 'types'),
it is not wrong in the way you think -- a
Ethan Furman wrote:
PS
I have a broken sense of humor -- sometimes it works, sometimes it
doesn't. My apologies in advance if my attempt at humor was not funny.
Now that was very unpythonic. Know where your roots are! :)
--
PointedEars
Bitte keine Kopien per E-Mail. / Please do not Cc:
On May 12, 2:29 pm, Ethan Furman et...@stoneleaf.us wrote:
While it is wrong (it should have 'built-in' precede the word 'types'),
it is not wrong in the way you think -- a subclass *is* a type of its
superclass.
Well, consider this:
class List_A(list):
A list subclass
class
Roy Smith wrote:
On May 12, 2:29 pm, Ethan Furman et...@stoneleaf.us wrote:
While it is wrong (it should have 'built-in' precede the word 'types'),
it is not wrong in the way you think -- a subclass *is* a type of its
superclass.
Well, consider this:
class List_A(list):
A list subclass
On Thu, 12 May 2011 09:43:23 -0700, Ethan Furman wrote:
MyList is a list -- just a more specific kind of list -- as can be seen
from its mro; this is analogous to a square (2 sets of parallel lines
joined at 90 degree angles, both sets being the same length) also being
a rectangle (2 sets of
Steven D'Aprano wrote:
On Thu, 12 May 2011 09:43:23 -0700, Ethan Furman wrote:
MyList is a list -- just a more specific kind of list -- as can be seen
from its mro; this is analogous to a square (2 sets of parallel lines
joined at 90 degree angles, both sets being the same length) also being
a
In article mailman.1479.1305217887.9059.python-l...@python.org,
Ethan Furman et...@stoneleaf.us wrote:
[http://docs.python.org/library/stdtypes.html]
Objects of different types, except different numeric types and different
string types, never compare equal
This part of the
12 matches
Mail list logo