Author Mark.Shannon
Recipients BTaskaya, Mark.Shannon
Date 2021-06-10.08:37:14
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Yes. Simpler is good.

I think it will also be better for performance:

In general, we don't know what X is in `from Y import X`. It could be a module or anything else.

However, if we are accessing an attribute it is quite likely to be a module or class.
For `X` defined by `from Y import X`, `X` is likely to be a module, class, function, or some sort of constant like a string, int or Enum.

If it is a string, int or function then it is rare to call a method on it, so we can ignore that case.
Calling methods on an Enum constant is probably not very common either (I'm guessing here)

For a module, `LOAD_ATTR; CALL_FUNCTION` is clearly better than `LOAD_METHOD; CALL_METHOD`.

For a class, specializing `LOAD_ATTR` is no more complex than `LOAD_METHOD`, probably simpler.
So, for a class `LOAD_ATTR; CALL_FUNCTION` is no worse than `LOAD_METHOD; CALL_METHOD`, and might be better.

Overall, it looks like `` when `X` is defiend by `from Y import X` is best as `LOAD_ATTR; CALL_FUNCTION` not `LOAD_METHOD; CALL_METHOD`.
Date User Action Args
2021-06-10 08:37:15Mark.Shannonsetrecipients: + Mark.Shannon, BTaskaya
2021-06-10 08:37:15Mark.Shannonsetmessageid: <>
2021-06-10 08:37:15Mark.Shannonlinkissue44313 messages
2021-06-10 08:37:14Mark.Shannoncreate