Skip to content

Instantly share code, notes, and snippets.

@dungvtdev
Last active November 1, 2016 10:09
Show Gist options
  • Select an option

  • Save dungvtdev/cb4a1f503e09b8d547b6b60d6ec5f5cd to your computer and use it in GitHub Desktop.

Select an option

Save dungvtdev/cb4a1f503e09b8d547b6b60d6ec5f5cd to your computer and use it in GitHub Desktop.

Circular dependency

http://effbot.org/zone/import-confusion.htm

Tricks

import random
random.choice(string.ascii_letters)

import json
_items = json.loads(f.read())
f.write(json.dumps(_items))

# dir: widgets/(controls.py) -> editor/(slider.py, utils.py)
# utils
from . import slider
from .. import controls ( tuong tu from ..., from ....)
# controls
from .editor import slider

#package hien tai cua module
print(__package__)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment