Jun-22-2018, 08:48 PM
(Jun-22-2018, 07:17 PM)micseydel Wrote: Yes, you showed good use ofis
. When I say type checking is discouraged, I mean usingtype(x) == blah
. Usingis
with an object (None) is very normal. (When you really need it, isinstance is used instead.)
Okay I think I understand. I sort of understand when I would use isinstance, I think:
if isinstance(loc,LatLong): loc = loc.UTM()as opposed to:
if type(loc) == types.InstanceType and loc.__class__ == LatLong: loc = loc.UTM()