Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a file parameter #1

Closed
xmedeko opened this issue Aug 26, 2016 · 3 comments
Closed

Add a file parameter #1

xmedeko opened this issue Aug 26, 2016 · 3 comments

Comments

@xmedeko
Copy link

xmedeko commented Aug 26, 2016

If the inserted_path would have the file option, then it could omit calling the sys._getframe. E.g.

>>> with current.inserted_path(file=__file__)
...     import australia

Note, I like to call it like current.inserted_path(__file__), but it would not be backward compatible.

@xflr6
Copy link
Owner

xflr6 commented Aug 27, 2016

Is there maybe a specific use case (or platform) where the current method fails for you?

AFAIR, the frame-based method was chosen because __file__ does not seem to work for all ways of executing Python, see SO question.

@xmedeko
Copy link
Author

xmedeko commented Aug 29, 2016

Nope, I have no specific platform failing with current method. I have just seen a few other solutions based on the __file__. And since I have experience from other programming languages that examining stack frames may be unreliable, I have thought the Python's __file__ is a good remedy for that. But I see from the SO answer that you have chosen the best solution and spend a good time to develop and test your solution.

So, now I trust the current method and apologies for wasting your time.

@xflr6
Copy link
Owner

xflr6 commented Aug 29, 2016

Nothing to apologize. Thanks for yout thoughts on improvement, closing.

@xflr6 xflr6 closed this as completed Aug 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants