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

More python 2/3 issues #11

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

Conversation

egelmex
Copy link
Contributor

@egelmex egelmex commented Apr 24, 2013

fixing dict_keys is not subscriptable.
work towards #5

@jadudm
Copy link
Member

jadudm commented Apr 25, 2013

So, while I like the idea of merging things in, I'd actually like it, for something like this, I have a question. For example, I don't

  1. have a working build.
  2. have a system with both Python 2 and Python 3 installed.
  3. have any instructions for how to test this merge request, given that it involves running a build with different Pythons active.

It seems like these are small changes that are part of a larger pull request; that is, there should be a series of commits terminating in one merge request, and that merge request should fix the Python 2/3 problem completely. Reviewing a whole bunch of one-line merge requests feels awfully tedious.

Given that we're establishing process, I'm just trying to understand how (for something like this) I'm supposed to support the process, given that I don't have everything in place yet. (I'm still trying to get the 32/64-bit issues worked out, so I have a reliable TVM-based build.

@egelmex
Copy link
Contributor Author

egelmex commented Apr 25, 2013

Sorry this was my bad, I meant to comment on this last night as I found a bunch more python3 issues to leave this pull request for now.

In regards to your points

  • have a working build.
    • This code is invoked before things start breaking
  • have a system with both Python 2 and Python 3 installed.
  • have any instructions for how to test this merge request, given that it involves running a build with different Pythons active.
  • This is a good point. I will try include instructions on testing this when I get a chance, got to fix the other python3 issues I found first.

@egelmex
Copy link
Contributor Author

egelmex commented Apr 25, 2013

It seems like these are small changes that are part of a larger pull request; that is, there should be a series of commits terminating in one merge request, and that merge request should fix the Python 2/3 problem completely. Reviewing a whole bunch of one-line merge requests feels awfully tedious.

On this note, you can review commits in a pull request, so if you leave a comment you don't have re-review code. Pull requests can be updated in situ, with more work as it's done. What you suggested is ideal, however I like to commit regularly and get feedback if early before too much work need redoing if choices were bad.

@jadudm
Copy link
Member

jadudm commented Apr 25, 2013

Sure thing.

In case it wasn't obvious, this was more a learning question for me, and
not really about a subscript fix on one line of python. :-)

Thank you.
On Apr 25, 2013 4:12 AM, "Martin Ellis" [email protected] wrote:

It seems like these are small changes that are part of a larger pull
request; that is, there should be a series of commits terminating in one
merge request, and that merge request should fix the Python 2/3 problem
completely. Reviewing a whole bunch of one-line merge requests feels
awfully tedious.

On this note, you can review commits in a pull request, so if you leave a
comment you don't have re-review code. Pull requests can be updated in
situ, with more work as it's done. What you suggested is ideal, however I
like to commit regularly and get feedback if early before too much work
need redoing if choices were bad.


Reply to this email directly or view it on GitHubhttps://github.com//pull/11#issuecomment-16993751
.

@egelmex
Copy link
Contributor Author

egelmex commented Apr 25, 2013

I have a logic error here somewhere I think...
building kroc (kroc not tvm flavour) with python3

make[2]: Entering directory `/home/me92/src/kroc-git/kroc-git/modules/bsclib/libsrc/filelib'
/home/me92/src/kroc-git/kroc-git/tools/kroc/occbuild --verbose --in-tree /home/me92/src/kroc-git/kroc-git --toolchain=kroc --library file.lib --include filelib.inc cfile.o filelib.tce
occbuild: Setting ISEARCH to: /home/me92/src/kroc-git/kroc-git/modules/inmoslibs/libsrc/forall:/home/me92/src/kroc-git/kroc-git/tvm/posix
occbuild: Running command: /home/me92/src/kroc-git/kroc-git/tools/kroc/kroc --in-tree /home/me92/src/kroc-git/kroc-git -I/home/me92/src/kroc-git/kroc-git/modules/inmoslibs/libsrc/forall -L/home/me92/src/kroc-git/kroc-git/modules/inmoslibs/libsrc/forall -I/home/me92/src/kroc-git/kroc-git/tvm/posix -L/home/me92/src/kroc-git/kroc-git/tvm/posix --incpath
occbuild: Running command: ar rc liboccam_file.a filelib.o cfile.o
ar: filelib.o: No such file or directory
occbuild: Command failed: ar rc liboccam_file.a filelib.o cfile.o

@@ -164,9 +163,9 @@ def compare_symbols(a, b):
prio_a = int(symbols[a].get("PRIO", 0))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I could do with some help converting this one into a keys= statement.

@atsampson
Copy link
Contributor

Apologies for the delayed response -- I don't think github notified me about the inline comment!

The way to fix that one is to turn compare_symbols into a function that returns the key for a symbol. You could also use enumerate() rather than the explicit counter. So something like (untested):

def enumerate_symbols(symbols):
    def sort_key(symbol):
        prio = int(symbols[symbol].get("PRIO", 0))
        return (prio, symbol)

    for i, symbol in enumerate(sorted(symbols.keys(), key=sort_key)):
        symbols[symbol]["offset"] = i

@atsampson
Copy link
Contributor

That also leaves only one call to safe_sorted, so you could probably just use list(sorted(...)) at the bottom too.

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

Successfully merging this pull request may close these issues.

3 participants