Nick Stinemates wrote: > Jeff Schwab wrote: >> Nick Stinemates wrote: >> >>>> I'm not saying I don't want to do that. I'm saying that, in addition to >>>> what you've written, I want foo to know it's being imported, and by whom. >>>> >> Please don't snip so much. >> >> >>> You're still not explaining a real example of what this could be used for. >>> >> Why would you say something like that? I told you *exactly* what I >> wanted to use it for. See Berwyn's post on the recent thread "Double >> underscores -- ugly?" He suggests that a suitable replacement for "if >> __name__ == '__main__'" might be "if sys.main()". I was looking for a >> way to implement that kind of function. Just like I told you when you >> asked me. You snipped it, along with most of the post. >> >> >>> Oh well, here's an example of an implementation of what you want to do. >>> >> Thanks. >> > Ah, I snipped because I was only replying to that specific part and > thought there was an archive of the rest. If that is unconventional I'll > stop. > > I suppose I did get a bit carried away. It seems people always want to > know 'who is calling my object' but I think writing a design around that is: > > a) Really hard to follow, much like GoTo statements > b) Poorly thought out > and, probably much more importantly > c) Grouping code together like that really limits what you can do > with it.. > > I'm sorry if I offended.
No problem! In general, I agree with those points completely. -- http://mail.python.org/mailman/listinfo/python-list