Skip to content

Instantly share code, notes, and snippets.

@readevalprint
Last active December 29, 2015 09:58
Show Gist options
  • Save readevalprint/7653435 to your computer and use it in GitHub Desktop.
Save readevalprint/7653435 to your computer and use it in GitHub Desktop.
Lesson 1: Namespace.
Why is this broken, and how would you fix it?
Directions:
$ wget https://gist.github.com/readevalprint/7653435/raw/random.py
$ python ./random.py
random() :
Traceback (most recent call last):
File "./random.py", line 2, in <module>
import random
File "/home/tim/django-bitcoin/django_bitcoin/random.py", line 4, in <module>
print "random() : ", random.random()
TypeError: 'module' object is not callable
#!/usr/bin/python
import random
# First random number
print "random() : ", random.random()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment