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

Update resource_library.py #55

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Update resource_library.py #55

wants to merge 3 commits into from

Conversation

tushushu
Copy link
Contributor

@tushushu tushushu commented Jan 22, 2018

Line 48: {base_dir, src} has been changed to [base_dir, src]
@advancedxy Hi there, I am going to fix those issues later~

48行{base_dir, src}改为[base_dir, src]
@advancedxy
Copy link
Collaborator

Hi, thanks for your contribution.

Since you mentioned in WeChat, there are other incompatible issues in resource_library.py with Python3. Do you mind fixing those issues in this RP altogether?

Copy link
Collaborator

@advancedxy advancedxy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, @tushushu I left one comment.

Generally speaking, you change is ok. So please let me know if you want to make another change or left as it is.

Also, I'd prefer to squash these three commits into one since they are small and all for fixing Python3 compatibility issue.

P.S: You can @ me in new comment. Otherwise I won't get email notification if you just edited in the first post

# Assume 'reduce' fuction needs to be imported in this way in future versions.
version_info = int(sys.version.split('.')[0])
if version_info > 2:
from functools import reduce
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can just use reduce from functools in python2 and python3 since the doc https://docs.python.org/2/library/functools.html#functools.reduce states that it's the same function with built-in reduce

Copy link
Contributor Author

@tushushu tushushu Jan 24, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks so much for letting me know this, and I prefer to use "from functools import reduce" directly.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, I will wait until you push a new change

print >> hfile, '#ifdef __cplusplus'
print >> hfile, 'extern "C" {'
print >> hfile, '#endif'
print('#ifdef __cplusplus', file=hfile)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we replace all those print calls? You can use ''' ''' to output multiple lines of text for better understanding.

Copy link
Collaborator

@chunyang-wen chunyang-wen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simple is better than complex.

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.

3 participants