Skip to content

Change __name__ to '__main__' #692

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

Closed
wants to merge 1 commit into from
Closed

Change __name__ to '__main__' #692

wants to merge 1 commit into from

Conversation

afrieder
Copy link
Contributor

@afrieder afrieder commented Jul 8, 2017

The behavior of other repls (python and ipython) is to set __name__ to '__main__'. You can test this by simply printing __name__ or by running bpython on some file that has a __name__ == '__main__' guard. This was first changed in #506 but as noted in that issue, the original reason for changing has been lost. Since __name__ == '__main__' is so common (it appears 16 times in this codebase alone), it's a significant annoyance to not be able to run files in bpython with that guard. I request you change it back to this more useful behavior.

@afrieder
Copy link
Contributor Author

afrieder commented Jul 8, 2017

(As you can probably tell by all these PRs, I've been using bpython a lot recently. It's awesome and I thank you so much for all the hard work that's been put in so far)

@sebastinas
Copy link
Contributor

Wouldn't that break -i again?

@afrieder afrieder closed this Jul 10, 2017
@afrieder afrieder deleted the __name__ branch July 10, 2017 23:50
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

Successfully merging this pull request may close these issues.

2 participants