A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2010-July/102510.html below:

[Python-Dev] unexpected import behaviour

[Python-Dev] unexpected import behaviour [Python-Dev] unexpected import behaviourDaniel Waterworth da.waterworth at gmail.com
Thu Jul 29 08:32:28 CEST 2010
Hi,

I'm not sure if this is a bug or not, I certainly didn't expect it. If
you create a file called test.py with the following contents,

class Test:
    pass

def test_1():
    import test
    print Test == test.Test

if __name__ == '__main__':
    test_1()

and then run it ($ python test.py), it'll print False. Now try:

$python
import test
test.test_1()

and it'll print True. Is this behaviour expected? What was the
rationale for it if is?

Thanks,

Daniel

-- 
active-thought.com
More information about the Python-Dev mailing list

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