|
Size: 939
Comment:
|
Size: 1021
Comment:
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 3: | Line 3: |
| - Easy things (that 2to3 handles pretty well): | * Drop support for < 2.6 (master currently supports 2.4) |
| Line 5: | Line 5: |
| - print function | * Easy things (that 2to3 handles pretty well): |
| Line 7: | Line 7: |
| - "in" vs. "has_key" | * print function |
| Line 9: | Line 9: |
| - "except Exception as exc" syntax | * "in" vs. "has_key" |
| Line 11: | Line 11: |
| - stdlib stuff | * "except Exception as exc" syntax |
| Line 13: | Line 13: |
| - Unicode | * stdlib stuff |
| Line 15: | Line 15: |
| - Unicode literals by default | * 2to3 is slooooow |
| Line 17: | Line 17: |
| - no implicit conversion between Unicode and bytes (encoding must be explicit) | * Unicode |
| Line 19: | Line 19: |
| - files must have explicit Unicode encoding, or be binary -- hard to do both at same time | * Unicode literals by default |
| Line 21: | Line 21: |
| - Exceptions | * no implicit conversion between Unicode and bytes (encoding must be explicit) * files must have explicit Unicode encoding, or be binary -- hard to do both at same time * Exceptions |
| Line 33: | Line 37: |
| - C/C++ issues | * C/C++ issues |
| Line 35: | Line 39: |
| - For us, mostly hidden by using CXX | * For us, mostly hidden by using CXX |
| Line 37: | Line 41: |
| - PyCObject was dropped in Python 3.2 -- had to port CXX to use its replacement PyCapsule | * PyCObject was dropped in Python 3.2 -- had to port CXX to use its replacement PyCapsule |
matplotlib's experiences porting to Python 3.
* Drop support for < 2.6 (master currently supports 2.4)
* Easy things (that 2to3 handles pretty well):
- print function
- "in" vs. "has_key"
- "except Exception as exc" syntax
- stdlib stuff
* 2to3 is slooooow
* Unicode
- Unicode literals by default
- no implicit conversion between Unicode and bytes (encoding must be explicit)
- files must have explicit Unicode encoding, or be binary -- hard to do both at same time
* Exceptions
exceptions_found = []
try:
do_something()
except Exception as e:
exceptions_found.append(e)Since e now has a traceback member, this creates a cycle e -> traceback -> current stack frame -> e. This cycle will keep alive all local variables in all frames beneath the source of the exception.
* C/C++ issues
- For us, mostly hidden by using CXX
PyCObject was dropped in Python 3.2 -- had to port CXX to use its replacement PyCapsule
