Groups
Sign in
Groups
brython
Conversations
About
Send feedback
Help
How to make __name__ return "__main__" in exec
19 views
Skip to first unread message
Carlo Oliveira
unread,
Aug 1, 2015, 4:08:35 PM
8/1/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to brython
Older versions of on line Brython would return "__main__" for __name__. Now they return exec_[number].
I want to use ace editor to teach python to my students to use the famous boilerplate:
if __name__ == "__main__":
main()
Currently I have to teach a weird variation:
if "exec_" in __name__:
main()
That is not compatible with Desktop Python and they have to change their code to run in Cpython.
How can a tune exec as to make __name__ = "__main__"?
This will help them to produce modules that can be tested as stand_alone but remain unchanged when tied together as a large program.
Olemis Lang
unread,
Aug 1, 2015, 5:39:37 PM
8/1/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to bry...@googlegroups.com
Please , create a ticket . Thanks for the report .
> --
> You received this message because you are subscribed to the Google Groups
> "brython" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
brython+u...@googlegroups.com
.
> To post to this group, send email to
bry...@googlegroups.com
.
> To view this discussion on the web visit
>
https://groups.google.com/d/msgid/brython/0818a666-3295-4e64-a2c5-624a8abad0d0%40googlegroups.com
.
> For more options, visit
https://groups.google.com/d/optout
.
>
--
Regards,
Olemis - @olemislc
Apache™ Bloodhound contributor
http://issues.apache.org/bloodhound
http://blood-hound.net
Blog ES:
http://simelo-es.blogspot.com/
Blog EN:
http://simelo-en.blogspot.com/
Featured article:
Reply all
Reply to author
Forward
0 new messages