Python 3 Incompatibility (?)
See original GitHub issueOn lines 691-692 of __init__.py in the minConflicts.getSolution(...) method, you have the following:
lst = domains.keys()
random.shuffle(lst)
The call to random.shuffle() fails on python 3, because in python3 the dictionary .keys() method returns a set, which can't be indexed. So lst must be converted from this set into a list:
lst = list(domains.keys())
random.shuffle(lst)
Not sure how you would write the code to be compatible in both Python2 and Python3
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
Porting Python 2 Code to Python 3 — Python 3.11.1 ...
Modernize, on the other hand, is more conservative and targets a Python 2/3 subset of Python, directly relying on six to help provide...
Read more >Cheat Sheet: Writing Python 2-3 compatible code
Easy, clean, reliable Python 2/3 compatibility · File IO with open() · reduce() · raw_input() · input() · file() · exec · execfile()...
Read more >Python Language Tutorial => Incompatibilities moving from ...
Python 3 intentionally broke backwards-compatibility, to address concerns the language developers had with the core of the language. Python 3 receives new ...
Read more >Supporting Python 2 and 3 without 2to3 conversion
Python 2.7 has some small improvements on Python 3 compatibility, but it's likely that if you want to run the same code under...
Read more >1 - Stack Overflow
Code incompatibility issues - Python 2.x/ Python 3.x ; from · import ABCMeta, abstractmethod class ; Instruction · object): __metaclass__ = ABCMeta ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Same issue in
Constraint.preProcess, trying to accessvariables[0], coming fromdomain.keys()inProblem._getArgs.Created a PR for
Constraint.preProcessissue: https://github.com/python-constraint/python-constraint/pull/37. Please review.