Skip to content

python3 porting#74

Merged
dongweiming merged 1 commit intopython-cn:masterfrom
dongweiming:python3
May 8, 2015
Merged

python3 porting#74
dongweiming merged 1 commit intopython-cn:masterfrom
dongweiming:python3

Conversation

@dongweiming
Copy link
Copy Markdown
Contributor

我已经更新了guide. 添加了python3代码支持的说明. 写python3兼容的代码.

使用from __future__ import absolute_import是因为python3不支持Implicit relative imports

比如我之前的PPT. 在python3下是被强制absolute_import的:

python
Python 2.7.3 (default, Apr 10 2013, 06:20:15) 
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from for_absolute_import.main import string
>>> string
<module 'for_absolute_import.string' from 'for_absolute_import/string.py'>
>>> 
python3
Python 3.4.2+ (3.4:463bbd862887, Jan 26 2015, 22:09:39) 
[GCC 4.6.3] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from for_absolute_import.main import string
>>> string
<module 'string' from '/usr/local/lib/python3.4/string.py'>

dongweiming added a commit that referenced this pull request May 8, 2015
@dongweiming dongweiming merged commit 2bb2352 into python-cn:master May 8, 2015
@dongweiming dongweiming deleted the python3 branch June 4, 2015 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant