[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] python3 issues



On Tue, Mar 26, 2019 at 10:06:48PM +0100, Hans van Kranenburg wrote:
> 
> Python 3 no longer allows comparing string and int, because it doesn't
> make sense.
> 
> == sorted([1,2,3,'a','b','c'])
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> TypeError: unorderable types: str() < int()
> 
> So I guess that if the contents are expected to be "saved" or a number
> as string like "1", "2", then:
> 
> 1. check for "saved"
> 2. try: int(val) except: blah
> 3. etc
> 

Actually I think you scheme here is better. Relying on string comparison
seems to be error-prone.

Wei.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.