Created
June 7, 2012 08:14
-
-
Save alvesjnr/2887354 to your computer and use it in GitHub Desktop.
How to get the subclass path
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import inspect | |
import os | |
class F(object): | |
@classmethod | |
def _get_path(cls): | |
""" | |
If called by subclass of F will return the path | |
of the subclass | |
""" | |
return os.path.dirname(inspect.getabsfile(cls)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment