Why can Python use underline instead of dot on import -


for example can use oslo_db replace oslo.db import (see first comment on this patch set:

from oslo.db import exception db_exc 

yamamoto takashi: oslo_db

and can't find oslo_db module in openstack git repo or search in pip.

what's more, boot vm , find it's ok use oslo_db or oslo.db since installed oslo.db.

image: (import oslo_db example , installed oslo.db):

i have seen article this, sorry have forget it.

you can't use _ replace . separator. not without additional effort module authors.

for module can, there actual module name underscore importing packaged namespace.

see oslo github package example, you'll find 2 top-level directories, each __init__.py file make them packages: oslo , oslo_db.

this invariably done transition 1 style other, , allowing both versions makes transition easier. in case appears developers moving away oslo.db nested namespace; changelog 1.4.0 includes entry:

  • move files out of namespace package

and commit message states:

move public api out of oslo.db oslo_db. retain ability import old namespace package backwards compatibility release cycle.

the linked launchpad blueprint no longer available you'll have ask openstack community why did this.

python project names not have correspond packages , modules contain. example, beautifulsoup project packages bs4 module beautifulsoup4. such oslo_db package part of oslo.db python project.


Comments

Popular posts from this blog

node.js - Using Node without global install -

How to access a php class file from PHPFox framework into javascript code written in simple HTML file? -

java - Null response to php query in android, even though php works properly -