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/2001-February/013119.html below:

[Python-Dev] Those import related syntax errors again...

[Python-Dev] Those import related syntax errors again... [Python-Dev] Those import related syntax errors again...Fredrik Lundh fredrik@pythonware.com
Thu, 22 Feb 2001 22:40:09 +0100
Thomas wrote:
> While on the subject: will all of 'from module import *' be deprecated, even
> at module level ?

hopefully not -- that would break tons of code, instead of
just some...

> How should code like Mailman's mm_cfg.py/Defaults.py construct be 
> rewritten to provide similar functionality ? Much as I dislike 'from module
> import *', it really does have its uses.

how about:

#
# mm_config.py

class config:
    # defaults goes here
    spam = "spam"
    egg = "egg"

# load user overrides
import mm_cfg
config.update(vars(mm_cfg))

#
# some_module.py

from mm_config import config

print "breakfast:", config.spam, config.egg

Cheers /F




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