Are the python built-in methods available in an alternative namespace anywhere?

前端 未结 2 648
渐次进展
渐次进展 2020-12-20 19:48

Are the python built-in methods available to reference in a package somewhere?

Let me explain. In my early(ier) days of python I made a django model similar to this

2条回答
  •  生来不讨喜
    2020-12-20 20:26

    Use builtins, or __builtin__ if you're on Python 2.

    def open():
        pass
    
    import __builtin__
    
    print open
    print __builtin__.open
    

    This gives you:

    
    
    

提交回复
热议问题