PPPLDeepLearning / plasma-python

PPPL deep learning disruption prediction package
http://tigress-web.princeton.edu/~alexeys/docs-web/html/
79 stars 43 forks source link

Python3 compatibility #11

Closed ASvyatkovskiy closed 7 years ago

ASvyatkovskiy commented 7 years ago

This pull request implements compatibility changes for Python3.6. This includes:

-- Indentation ambiguity between tabs and spaces -- generator.next() -> next(generator) -- Integer division: / -> // -- Take into account the fact that zip returns a generator in Python3 rather than list

Needs testing under both Python3.6 and Python2.7

ASvyatkovskiy commented 7 years ago

@jnkh Hi Julian,

Whjat is the desired behaviour for sorting here: https://github.com/PPPLDeepLearning/plasma-python/blob/master/examples/guarantee_preprocessed.py#L21

It basically sorts a list of shots (Python objects of type Shot) based on the memory address (in Python2.7). In Python3.6 it seems to be not possible/feasible. It can be sorted based on an attribute given a lambda.

Thoughts?