471,335 Members | 1,473 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,335 software developers and data experts.

Fwd: Namespace question

2007/10/31, Frank Aune <Fr********@broadpark.no>:

Is it possible writing custom modules named the same as modules in the
standard library, which in turn use the same module from the standard

Say I want my application to have a random.py module, which in turn must
import the standard library random.py module also, to get hold of the randint
function for example.

My attempts so far only causes my random.py to import itself instead of the
standard library random.py

Receipt for disaster? :)
You mean something like this:
>>>import random
def foo():
.... print '42'
>>>random.randit = foo

am I right?
Wbr, Andrii Mishkovskyi.

He's got a heart of a little child, and he keeps it in a jar on his desk.
Oct 31 '07 #1
0 844

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Ralph Freshour | last post: by
2 posts views Thread by Balbir Singh | last post: by
1 post views Thread by jake77.lucas | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.