Skip to content

Tag: python

In django what is the use of urls.py for each app?

I am making a django project and i learnt that we need to create a urls.py file for each app created within project. Can anyone please tell what is the purpose of this because we have one urls.py file for the main project, isn’t that enough? Answer Mostly for reusability, partly for organizational reaso…

Getting City from IP Address range

I have an IP address. For example, 192.168.2.10 Also I have a dictionary: Question: How should I find the city from my IP address and use this dictionary spending less time (time complexity) as possible? Answer The “proper answer” if you want the best complexity for arbitrarily large data sets is …

Why is it dangerous to convert integers to float16?

I have run recently into a surprising and annoying bug in which I converted an integer into a float16 and the value changed: This is likely not a bug, because it happens also for PyTorch. I guess it is related to half-float representation, but I couldn’t figure out why 2049 is the first integer that is …