Skip to content
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

item4 opened this issue Dec 12, 2016 · 1 comment

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

item4 opened this issue Dec 12, 2016 · 1 comment


Copy link

@item4 item4 commented Dec 12, 2016

모듈 구조

    - web/
        - admin/


$ python -V
Python 3.5.2
$ cat s/web/admin/
from .form import RoomForm
from ..db import sess
$ import-order s
s/web/admin/ ..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으로 나누면서 생기는 일로 보입니다.


This comment has been minimized.

Copy link

@kanghyojun kanghyojun commented Dec 14, 2016

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants
You can’t perform that action at this time.