Questions tagged [python-3.x]
DO NOT USE UNLESS YOUR QUESTION IS FOR PYTHON 3 ONLY. Always use alongside the standard [python] tag.
python-3.x
343,837
questions
3
votes
1
answer
906
views
Python 3.1 inline division override
I don't know if this is a bug in 3.1, but if I remember correctly "inline" division worked like this in pre-3k versions:
Python 3.1 (r31:73574, Jun 26 2009, 20:21:35) [MSC v.1500 32 bit (Intel)] on ...
2
votes
3
answers
281
views
Generating a list from complex dictionary
I have a dictionary dict1['a'] = [ [1,2], [3,4] ] and need to generate a list out of it as l1 = [2, 4]. That is, a list out of the second element of each inner list. It can be a separate list or even ...
2
votes
4
answers
3k
views
Finding set difference between two complex dictionaries
I have two dictionaries of the following structure:
a) dict1 = {'a':[ [1,2], [3,4] ], 'b':[ [1,2],[5,6] ]}
b) dict2 = {'a':[ [1,2], [5,6] ], 'b':[ [1,2],[7,8] ]}
I need to find the set difference ...
0
votes
2
answers
932
views
How to call super() in Python 3.0?
I have the strangest error I have seen for a while in Python (version 3.0).
Changing the signature of the function affects whether super() works, despite the fact that it takes no arguments. Can you ...
0
votes
1
answer
729
views
dbm.error: db type is dbm.bsd, but the module is not available (Python 3.0)
I'm trying to open a shelve file that I created in 2.5, but I get the error I listed in the question title.
The data aren't essential, but I really want them.
Looking at the lib\dbm\__init__.py ...
2
votes
4
answers
9k
views
Python 3.1.1 on Mac OS X 10.6 Snow Leopard
I've spent some time today playing with getting the source for python 3.1.1 to build on my MacBook Pro using the --enable-framework and --enable-universalsdk options with no success. I will humbly ...
441
votes
10
answers
1.6m
views
"Unicode Error 'unicodeescape' codec can't decode bytes..." when writing Windows file paths [duplicate]
I am using Python 3.1 on a Windows 7 machine. Russian is the default system language, and utf-8 is the default encoding.
Looking at the answer to a previous question, I have attempting using the "...
1
vote
3
answers
1k
views
Python design patterns, cross importing
I am using Python for automating a complex procedure that has few options.
I want to have the following structure in python.
- One "flow-class" containing the flow
- One helper class that contains a ...
6
votes
3
answers
8k
views
Python 3 unittest simulate user input
How can I simulate user input in the middle of a function called by a unit test (Using Python 3's unittest)? For example, I have a function foo() who's output I'm testing. In the foo() function, it ...
1898
votes
18
answers
1.2m
views
Proper way to declare custom exceptions in modern Python?
What's the proper way to declare custom exception classes in modern Python? My primary goal is to follow whatever standard other exception classes have, so that (for instance) any extra string I ...
15
votes
6
answers
11k
views
Alter Django admin change list title text
I'm creating some custom views for the Django admin interface that use the standard change-list as an interim stage. This works fine, apart from the fact the change-list page H1 is 'Select object to ...
14
votes
3
answers
31k
views
XPath Query in XML using Python
Is it possible to use XPath Query in Python while processing XML. I am using minidom which doesn't support that. Is there any other module for that?
81
votes
4
answers
86k
views
What is the oldest time that can be represented in Python?
I have written a function comp(time1, time2) which will return True when time1 is less than time2. I have a scenario where time1 should always be less than time2. I need time1 to have the least ...
5
votes
1
answer
4k
views
python 3.1 with pydev
I am now moving to eclipse for my python development. I have pydev installed but it is showing grammar support up to python version 3.0. My question is can I use python 3.1 with 3.0 grammar? Has the ...
646
votes
11
answers
639k
views
Getting a map() to return a list in Python 3.x [duplicate]
I'm trying to map a list into hex, and then use the list elsewhere. In python 2.6, this was easy:
A: Python 2.6:
>>> map(chr, [66, 53, 0, 94])
['B', '5', '\x00', '^']
However, in Python 3....