On Thu, Aug 17, 2000 at 11:19:42PM +0200, Thomas Wouters wrote: > This also means that a 'global' statement now has effect on objects > 'imported from' a module, *except* those imported by '*'. And while I was checking my documentation patches, I found this: Names bound by \keyword{import} statements may not occur in \keyword{global} statements in the same scope. \stindex{global} But there doesn't seem to be anything to prevent it ! On my RedHat supplied Python 1.5.2: >>> def test(): ... global sys ... import sys ... >>> test() >>> sys <module 'sys' (built-in)> And on a few weeks old CVS Python: >>> def test(): ... global sys ... import sys ... >>> test() >>> sys <module 'sys' (built-in)> Also, mixing 'global' and 'from-import' wasn't illegal, it was just ineffective. (That is, it didn't make the variable 'global', but it didn't raise an exception either!) How about making 'from module import *' a special case in this regard, and letting 'global' operate fine on normal 'import' and 'from-import' statements ? I can definately see a use for it, anyway. Is this workable (and relevant) for JPython / #Py ? -- Thomas Wouters <thomas@xs4all.net> Hi! I'm a .signature virus! copy me into your .signature file to help me spread!
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4