New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

from ... import ~ 를 썼을 때의 정렬 순서 문제 #26

Closed
item4 opened this Issue Dec 12, 2016 · 1 comment

Comments

Projects
None yet
2 participants
@item4
Contributor

item4 commented Dec 12, 2016

모듈 구조

s/
    - web/
        - admin/
            form.py
            room.py
        - db.py

문제현상

$ python -V
Python 3.5.2
$ cat s/web/admin/room.py
...
from .form import RoomForm
from ..db import sess
...
$ import-order s
s/web/admin/room.py:10-11: ..db.sess must be above than .form.RoomForm
10 from .form import RoomForm
11 from ..db import sess

이상하다고 생각하는 이유

from .form import RoomForm의 경우는 풀어적으면 from s.web.admin.form import RoomForm이고 from ..db import sess의 경우는 from from s.web.db import sess이고, 풀어적은 것을 기준으로 알파벳순으로 정렬해서 보면

from s.web.admin.form import RoomForm
from s.web.db import sess

이 순서가 맞다고 생각하는데 실제로는 역순을 요구합니다.

제가 보기엔 from절을 한번 . 기준으로 rpartition으로 나누면서 생기는 일로 보입니다.

item4 added a commit to item4/import-order that referenced this issue Dec 12, 2016

item4 added a commit to item4/import-order that referenced this issue Dec 12, 2016

@kanghyojun

This comment has been minimized.

Member

kanghyojun commented Dec 14, 2016

#27 (comment) 에도 적었지만 relative import 할때 순서에 대해서 옵션을 줘서 올림차순으로 정렬할수 있도록 하는게 어떨까요?

item4 added a commit to item4/import-order that referenced this issue Dec 14, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment