From: Han Holl Date: 2005-05-26T16:56:57+09:00 Subject: Re: if __FILE_ == $0 executed twice On 5/26/05, nobuyoshi nakada wrote: > Till 1.8, $: includes `require'd names relative to one of $LOAD_PATH, > $0 is absolute path or relative from cwd in other hand. So comparing > $0 with $: had no meanings, however it might be in 1.9. > I see. While thinking it over, I realize that there would remain a race condition anyhow. In other words, the code would always first be executed in the required copy, because it cannot be put in $" until the entire file is processed. Maybe if __FILE__ == $0 and caller(0).size == 1 isn't so bad after all. Maybe there isn't a one-on-one replacement for Pythons if __name__ == '__main__' after all. Han Holl