This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: 2to3's fix_xrange needs fix_dict's context information
Type: behavior Stage:
Components: 2to3 (2.x to 3.x conversion tool) Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: collinwinter Nosy List: collinwinter
Priority: normal Keywords:

Created on 2008-04-08 19:12 by collinwinter, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg65204 - (view) Author: Collin Winter (collinwinter) * (Python committer) Date: 2008-04-08 19:12
2to3 should be able to translate the code snippet below successfully.
First guess: generalizing fix_dict's notion of special contexts would do
the trick.

import random

numbers = range(1, 50)
chosen = []

while len(chosen) < 6:
    number = random.choice(numbers)
    numbers.remove(number)
    chosen.append(number)

chosen.sort()
print("This week's numbers are", chosen)
print("The bonus ball is", random.choice(numbers))
msg65222 - (view) Author: Collin Winter (collinwinter) * (Python committer) Date: 2008-04-08 22:15
Fixed in r62232. Verified that the sample code below runs successfully
under Python 3.0a4+ (r62209) after being run through 2to3.
History
Date User Action Args
2022-04-11 14:56:33adminsetgithub: 46848
2008-04-08 22:15:07collinwintersetstatus: open -> closed
resolution: fixed
messages: + msg65222
title: 2to3's fix_range needs fix_dict's context information -> 2to3's fix_xrange needs fix_dict's context information
2008-04-08 19:12:46collinwintercreate