Duncan Gibson wrote:
> I've taken over someone else's code (yes, honestly!) that has a
> complex class hierarchy on top of the main procedural code. This
> is unfortunate because it means that isinstance() is everywhere.
>
> Profiling recently highlighted one particular formatted output
> function
I wrote:
> >def newOutput(x):
> >if x is None:
> >pass
> >return
> >try:
> >x.output()
> >except AttributeError:
> >if isinstance(x, int):
> >pass
> >elif isinstance(x, float):
> >
> I've taken over someone else's code (yes, honestly!) that has a
> complex class hierarchy on top of the main procedural code. This
> is unfortunate because it means that isinstance() is everywhere.
It shouldn't do. Multiple uses of isinstance is usually a sign
of bad OO design, regardlerss of wh
I've taken over someone else's code (yes, honestly!) that has a
complex class hierarchy on top of the main procedural code. This
is unfortunate because it means that isinstance() is everywhere.
Profiling recently highlighted one particular formatted output
function that has a cascade of isinstan