网上论坛
登录
网上论坛
brython
会话
关于
发送反馈
帮助
How to make __name__ return "__main__" in exec
已查看 19 次
跳至第一个未读帖子
Carlo Oliveira
未读,
2015年8月1日 16:08:35
2015/8/1
回复作者
登录即可回复作者
转发
登录即可转发
删除
您无权在此群组中删除帖子
复制链接
举报消息
显示原始帖子
要么此群组的电子邮件地址为匿名状态,要么您得查看成员电子邮件地址权限才能查看原始帖子
收件人 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
未读,
2015年8月1日 17:39:37
2015/8/1
回复作者
登录即可回复作者
转发
登录即可转发
删除
您无权在此群组中删除帖子
复制链接
举报消息
显示原始帖子
要么此群组的电子邮件地址为匿名状态,要么您得查看成员电子邮件地址权限才能查看原始帖子
收件人 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:
回复全部
回复作者
转发
0 个新帖子