Is there Python equivalent to Perl BEGIN{} block?

Bruno Desthuilliers bruno.42.desthuilliers at wtf.websiteburo.oops.com
Thu Mar 13 07:02:23 EDT 2008


Alex a écrit :
(sni)
> First of all thanks all for answering!
> 
> I have some environment check and setup in the beginning of the code.
> I would like to move it to the end of the script.

Why ? (if I may ask...)

> But I want it to
> execute first, so the script will exit if the environment is not
> configured properly.

If you want some code to execute first when the script/module is loaded, 
then keep this code where it belongs : at the beginning of the script.




More information about the Python-list mailing list