Re: from ./.. import

2019-10-04 Thread Terry Reedy
On 10/4/2019 9:01 AM, Hongyi Zhao wrote: Hi, See this file: https://github.com/hongyi-zhao/dotbot/blob/master/dotbot/messenger/ messenger.py It has the following codes: from ..util.singleton import Singleton from ..util.compat import with_metaclass from .color import Color from .level import L

Re: from ./.. import

2019-10-04 Thread Jon Ribbens via Python-list
On 2019-10-04, Hongyi Zhao wrote: > See this file: > https://github.com/hongyi-zhao/dotbot/blob/master/dotbot/messenger/ > messenger.py > > It has the following codes: > > from ..util.singleton import Singleton > from ..util.compat import with_metaclass > from .color import Color > from .level imp

Re: from import and __init__.py

2010-03-26 Thread Gregory Ewing
egbert wrote: Yes, you are right. And I can reach everything with modules['some_package'] or variants thereof. Although note that the usual way to get it would be to simply do import some_package -- Greg -- http://mail.python.org/mailman/listinfo/python-list

Re: from import and __init__.py

2010-03-25 Thread egbert
On Thu, Mar 25, 2010 at 12:43:13PM -0400, Terry Reedy wrote: > On 3/25/2010 6:16 AM, egbert wrote: > >When I do 'from some_package import some_module' > >the __init__.py of some_package will be run. > >However, there will not be anything like a package-module, > >and the effects of __init__.py see

Re: from import and __init__.py

2010-03-25 Thread Terry Reedy
On 3/25/2010 6:16 AM, egbert wrote: When I do 'from some_package import some_module' the __init__.py of some_package will be run. However, there will not be anything like a package-module, and the effects of __init__.py seem all to be lost. Is that true ? No. If you do from sys import modules

Re: from import and __init__.py

2010-03-25 Thread Steve Holden
egbert wrote: > When I do 'from some_package import some_module' > the __init__.py of some_package will be run. > However, there will not be anything like a package-module, > and the effects of __init__.py seem all to be lost. Is that true ? > Or can I still do something useful with __init__.py ?

Re: from... import...

2007-02-02 Thread Ben Finney
[EMAIL PROTECTED] writes: > what's the from ... import keyword use for? > for example - from contenttype import getContentType > > import os > import sys > import getopt > import types > import re > import pprint > import logging > from contenttype import getContentType The program now can access

Re: from... import...

2007-02-02 Thread Paddy
On Feb 3, 4:12 am, [EMAIL PROTECTED] wrote: > what's the from ... import keyword use for? > for example - from contenttype import getContentType > > import os > import sys > import getopt > import types > import re > import pprint > import logging > from contenttype import getContentType > > In Jav

Re: from... import...

2007-02-02 Thread Stargaming
[EMAIL PROTECTED] schrieb: > what's the from ... import keyword use for? > for example - from contenttype import getContentType > > import os > import sys > import getopt > import types > import re > import pprint > import logging > from contenttype import getContentType > > In Java what kind of