/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to doc/developers/code-style.txt

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-10-15 11:29:38 UTC
  • mfrom: (5499.1.1 trunk)
  • Revision ID: pqm@pqm.ubuntu.com-20101015112938-8585tdgvnin38kfv
(vila) Add bzrlib/pyutils.py,
        and replace uses of __import__ with calls to pyutils.get_named_object
        (Andrew Bennetts)

Show diffs side-by-side

added added

removed removed

Lines of Context:
485
485
 
486
486
 * Don't say "open source" when you mean "free software".
487
487
 
 
488
 
 
489
Dynamic imports
 
490
===============
 
491
 
 
492
If you need to import a module (or attribute of a module) named in a
 
493
variable:
 
494
 
 
495
 * If importing a module, not an attribute, and the module is a top-level
 
496
   module (i.e. has no dots in the name), then it's ok to use the builtin
 
497
   ``__import__``, e.g. ``__import__(module_name)``.
 
498
 * In all other cases, prefer ``bzrlib.pyutils.get_named_object`` to the
 
499
   built-in ``__import__``.  ``__import__`` has some subtleties and
 
500
   unintuitive behaviours that make it hard to use correctly.
 
501
 
488
502
..
489
503
   vim: ft=rst tw=74 ai