[Yum-devel] [PATCH] clean up all the import yum.blah and from yum.blah import blah
Seth Vidal
skvidal at fedoraproject.org
Wed Sep 30 18:39:07 UTC 2009
On Wed, 30 Sep 2009, Tim Lauridsen wrote:
> On 09/30/2009 04:20 PM, Seth Vidal wrote:
>>
>>
>> On Wed, 30 Sep 2009, Tim Lauridsen wrote:
>>
>>>> from constants import *
>>>> import metalink
>>>>
>>>
>>> Why ?
>>>
>>> from yum.i18n import ....
>>>
>>> is more readable than
>>>
>>> from i18n import .....
>>>
>>> and it is easier to see what is a yum submodule.
>>>
>>
>> That's a fair point - major concern I've ever had is importing the wrong
>> module if you're working in a separate working path.
>>
>> maybe that's not a real concern but it was at one point for me and I got
>> into that habit.
>>
>> You do make a good point about figuring out what is from the yum module
>> and what is not, though..
>>
>> I'll think about it.
>>
>
> Another point is Python 3, where local dir imports are changed[1] so.
>
> import constants (Python 2.x)
>
> will be
>
> from . import constants (Python 3.x)
>
> but
>
> import yum.constants
>
> with work in both 2.x and 3.x
>
and moreover it looks like other things break. Long and short, I was wrong
about this but we also need to go through and move all of the imports over
to 'yum.'. I'll work on doing this shortly since it is likely to matter in
the medium term.
in the meantime I reverted the patch I did and I'll work on some more
soon.
sorry everyone
-sv
More information about the Yum-devel
mailing list