[Tutor] global variables/constants versus volatile variables/constants

diliup gabadamudalige diliupg at gmail.com
Fri Jun 13 09:21:25 CEST 2014


Hi All!
Hope everyone is well.

In my code there are many dictionaries and lists which are used in various
functions. Is it better/pythonic/efficient to have these inside the
function itself or declared at the beginning of the program in which case
they will be global? They are all read only. I understand that global
constants and variable have memory allocated to them but when declared
inside a function are created on the fly, used and discarded. Please
enlighten me further on this and correct me if i'm wrong.

Thank you for your time and may you be well.
-- 
Diliup Gabadamudalige

http://www.diliupg.com
http://soft.diliupg.com/

**********************************************************************************************
This e-mail is confidential. It may also be legally privileged. If you are
not the intended recipient or have received it in error, please delete it
and all copies from your system and notify the sender immediately by return
e-mail. Any unauthorized reading, reproducing, printing or further
dissemination of this e-mail or its contents is strictly prohibited and may
be unlawful. Internet communications cannot be guaranteed to be timely,
secure, error or virus-free. The sender does not accept liability for any
errors or omissions.
**********************************************************************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20140613/81dfad9a/attachment.html>


More information about the Tutor mailing list