The Artima Developer Community
Sponsored Link

Python Buzz Forum
Module import fun

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Richard Jones

Posts: 55
Nickname: rjones
Registered: Jul, 2003

Richard Jones is an over-eager Python Open Source programmer
Module import fun Posted: Aug 11, 2003 12:55 AM
Reply to this message Reply

This post originated from an RSS feed registered with Python Buzz by Richard Jones.
Original Post: Module import fun
Feed Title: Richard's stuff
Feed URL: http://mechanicalcat.net/cgi-bin/log?flav=rss
Feed Description: Stuff I'm interested in
Latest Python Buzz Posts
Latest Python Buzz Posts by Richard Jones
Latest Posts From Richard's stuff

Advertisement

Just a little snippet of python wierdness :)

Python 2.3 (#1, Aug  4 2003, 10:17:00)
[GCC 3.3.1 (Mandrake Linux 9.2 3.3.1-0.7mdk)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> open('foo.py', 'w').write('a=1\nb=1/0')
>>> import foo
Traceback (most recent call last):
  File "", line 1, in ?
  File "foo.py", line 2, in ?
    b=1/0
ZeroDivisionError: integer division or modulo by zero
>>> import sys
>>> sys.modules['foo']

>>> foo.a
Traceback (most recent call last):
  File "", line 1, in ?
NameError: name 'foo' is not defined
>>> import foo
>>> foo.a
1

Kinda quirky, but any self-respecting application should barf at the first error :)

Read: Module import fun

Topic: Thinking in Porn: Bruce Eckel speaks Previous Topic   Next Topic Topic: More stuff that doesn't suck - TwistedPython

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use