[melbourne-pug] Data type assumptions in Python
Ben Finney
ben+python at benfinney.id.au
Thu Sep 5 06:37:34 CEST 2013
Javier Candeira <javier at candeira.com> writes:
> I have a sorted list.
What do you mean? Is this a Python builtin list that you have sorted? If
not, where did this ‘sorted_list’ come from?
> I can put in all numeric or all strs, or any type that's orderable to
> all the others:
>
> >>> sorted_list(1, 3, 5.0, 7, 6, 4, 2.0)
> [1, 2.0, 3, 4, 5.0, 6, 7]
> >>> sorted_list('a', 'c', 'e', 'd', 'b')
> ['a', 'b', 'c', 'd', 'e']
>
> But if I put in an incompatible/unorderable type, I get a TypeError:
> not comparable.
Who is “I” in all this? There are multiple points of responsibility
being discussed, and I don't know which one you're identifying with by
“I”.
--
\ “Dare to be naïve.” —Richard Buckminster Fuller, personal motto |
`\ |
_o__) |
Ben Finney
More information about the melbourne-pug
mailing list