This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2013年05月27日 15:03 by brett.cannon, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Messages (3) | |||
|---|---|---|---|
| msg190143 - (view) | Author: Brett Cannon (brett.cannon) * (Python committer) | Date: 2013年05月27日 15:03 | |
I'm contemplating adding an implementation of importlib.abc.InspectLoader.get_code() which relies on get_source() (and then another version in ExecutionLoader which uses get_filename()). The reason I'm hesitant is get_source() is often an expensive operation thanks to having to decode the source code and do a universal newline conversion. Now I could add the implementation but leave the method abstract, forcing users to make the decision to call super().get_code(), although that's still easy enough that I'm afraid people still won't take into consideration the performance implications. But maybe I'm worrying too much? We're consenting adults, right? So for that reason I'm leaning towards implementing but leaving abstract with a note in the docs that performance should be considered before just blindly calling the abstract method. |
|||
| msg190161 - (view) | Author: Brett Cannon (brett.cannon) * (Python committer) | Date: 2013年05月27日 23:36 | |
So it turns out I will simply have to make the methods not abstract anymore. Thanks to multiple inheritance I can't implement the method in ExecutionLoader and keep it abstract in case someone subclasses InspectLoader and then creates another subclass of ExecutionLoader and the InspectLoader subclass w/o making ExecutionLoader.get_code not abstract. But if I can't do it there then it seems silly to leave only InspectLoader.get_code abstract. IOW get_code will not longer be abstract and I will leave a note in the docs to mention you probably want to consider overriding the method for performance. |
|||
| msg190163 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2013年05月28日 01:12 | |
New changeset 11510db74223 by Brett Cannon in branch 'default': Issue #18072: Implement get_code() for importlib.abc.InspectLoader and http://hg.python.org/cpython/rev/11510db74223 New changeset 2ea849fde22b by Brett Cannon in branch 'default': NEWS entry for issue #18072 http://hg.python.org/cpython/rev/2ea849fde22b |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:46 | admin | set | github: 62272 |
| 2013年05月28日 01:15:26 | brett.cannon | set | status: open -> closed resolution: fixed stage: resolved |
| 2013年05月28日 01:12:50 | python-dev | set | nosy:
+ python-dev messages: + msg190163 |
| 2013年05月27日 23:36:53 | brett.cannon | set | messages: + msg190161 |
| 2013年05月27日 15:08:10 | brett.cannon | set | assignee: brett.cannon |
| 2013年05月27日 15:08:05 | brett.cannon | set | nosy:
+ eric.smith |
| 2013年05月27日 15:03:42 | brett.cannon | create | |