FAQ
Hi,

For the Python experts out there:

Are there any side effects in assigning new variables to the
__builtins__ module for the purpose of exposing variables to imported
modules.

For example.

#/ main file

class Test: pass

mytest = Test() #/ instance of a class
__builtins__.mytest = mytest

import abc


#/ -----------------------
#/ This is the abc.py module file
#/ This should work because of the __builtins__ above
print mytest

Thanks.

Search Discussions

  • Scott David Daniels at Mar 2, 2004 at 12:49 am

    Opinder wrote:

    Are there any side effects in assigning new variables to the
    __builtins__ module for the purpose of exposing variables to imported
    modules.
    Generally, Guido frowns at you very sternly. Also, you could
    cause a disaster if there is a conflict between your idea of what
    should be a global and some other module's idea. You will be in
    big trouble if a builtin is added that you over-write (actually
    a form of the same problem).

    --
    -Scott David Daniels
    Scott.Daniels at Acm.Org

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
categoriespython
postedMar 1, '04 at 9:48p
activeMar 2, '04 at 12:49a
posts2
users2
websitepython.org

2 users in discussion

Scott David Daniels: 1 post Opinder: 1 post

People

Translate

site design / logo © 2022 Grokbase