Fwd: Namespace question

Frank Aune Frank.Aune at broadpark.no
Wed Oct 31 12:59:32 EDT 2007


On Wednesday 31 October 2007 15:19:25 Andrii V. Mishkovskyi wrote:
> You mean something like this:
> >>>import random
> >>>def foo():
>
> ...    print '42'
>
> >>>random.randit = foo
> >>>random.randit()
>
> 42
>
> am I right?
> --

I was thinking more of the line:

random.py: (my custom random.py module)

---
import random # this is the std lib random module

def someFunc():
	print random.randint()
---

When I try this, the import statement in the above module will import itself, 
and not the std lib random.py

-Frank



More information about the Python-list mailing list