architv / soccer-cli

:soccer: Football scores for hackers. :computer: A command line interface for all the football scores.
MIT License
1.09k stars 220 forks source link

Use explicit relative imports #58

Closed Saturn closed 8 years ago

Saturn commented 8 years ago

Bad idea to use the old relative imports since if you have a duplicate name somewhere in your module path it might try and import the wrong module causing an error.

Saturn commented 8 years ago

Do you mean like

from soccer import leagueids, teammates

or

from soccer.writers import get_writer

I see the leading dot style a lot so I just did that. I don't think that style is totally discouraged but there is possibly situations when the absolute import is necessary.

ueg1990 commented 8 years ago

i see those alot too but apparently its in the PEP8 too where absolute imports are preferred: http://stackoverflow.com/questions/4209641/absolute-vs-explicit-relative-import-of-python-module/4209771#4209771

Saturn commented 8 years ago

Seems like not everyone likes them but now that the syntax is more standardised a lot of projects do the relative import.

So if it is a matter of style your preference is for absolute imports?

ueg1990 commented 8 years ago

that is my preference but not a necessity...its more important we follow a consistent format :)

Saturn commented 8 years ago

That is true.

@architv can pick a style he prefers.

architv commented 8 years ago

@Saturn @ueg1990 I think we should stick with absolute imports since that's the format followed in the package.

architv commented 8 years ago

@Saturn Let me know if there is any other issue or we can close the PR.

Saturn commented 8 years ago

Changed to use absolute imports. It seems to work for me.