Comparing the modules in Python. OK, but why? -
i going through question in checkio. , came across this.
import re,math re > math # returns true math > re # returns false
can explain how python compares between 2 things.
does python thing providing hierarchy modules. furthermore,
re > 1 # return true # ok, why?
i appreciate deep explanations on these things!
everthing object. , modules no exception. therefore:
import re, math print(id(re), id(math)) print(re > math) print(id(re) > id(math)) print(re < math) print(id(re) < id(math)) print(id(re), id(math))
in case:
39785048 40578360 false false true true 39785048 40578360
your mileage may vary, because ids not mine , therefore comparison may reversed in case.
Comments
Post a Comment