Questions tagged [python-3.3]

For issues that are specific to Python 3.3. Use the more generic [python] and [python-3.x] tags where possible.

Python is a dynamically and strongly typed programming language whose design philosophy emphasizes code readability. Two significantly different versions of Python (2 and 3) are in use.

Use this tag if your question is specifically about . If your question applies to Python in general, use the tag . If your question applies to Python 3.x but not to Python 2, use the tag . If you aren't sure, tag your question and mention which version you're using in the body of your question.

Python 3.3 was released on September 29, 2012, and has a number of new features:

Syntax:

  • The yield from expression for generator delegation is introduced.
  • The u'unicode' syntax (which disappeared in Python 3.0) returns.

New standard library modules:

  • faulthandler - helps debugging low-level crashes.
  • ipaddress - high-level objects representing IP addresses and masks.
  • lzma - compress data using the XZ / LZMA algorithm.
  • unittest.mock - replace parts of your system under test with mock objects.
  • venv - Python virtual environments, as in the popular virtualenv package.

... as well as a reworked I/O exception hierarchy, rewritten import machinery based on importlib, more compact unicode strings, and more compact attribute dictionaries.

The C Accelerator for the decimal module has also been significantly improved, as has the unicode handling in the email module.

Finally, for security reasons, hash randomization is now switched on by default.

1148 questions
13
votes
2 answers

Reverse for 'index' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []

I'm trying to get django-register to work on my website but I keep getting this error which I do not understand I'm using django 1.6 on Python 3.3 NoReverseMatch at /accounts/register/ Reverse for 'index' with arguments '()' and keyword arguments…
Charles Haro
  • 1,866
  • 3
  • 22
  • 36
13
votes
7 answers

How to make program go back to the top of the code instead of closing

I'm trying to figure out how to make Python go back to the top of the code. In SmallBasic, you do start: textwindow.writeline("Poo") goto start But I can't figure out how you do that in Python :/ Any ideas anyone? The code I'm trying to…
monkey334
  • 327
  • 2
  • 8
  • 23
12
votes
1 answer

Python unclosed resource: is it safe to delete the file?

Googled my way around this issue, but didn't find any solutions. I'm running Python 3.3 with Eclipse and PyDev plugin, and when I run any Python project, I get the following…
Mgamerz
  • 2,872
  • 2
  • 27
  • 48
12
votes
16 answers

sum of nested list in Python

I try to sum a list of nested elements e.g, numbers=[1,3,5,6,[7,8]] should produce sum=30 I wrote the following code : def nested_sum(L): sum=0 for i in range(len(L)): if (len(L[i])>1): sum=sum+nested_sum(L[i]) else: …
Jin
  • 1,203
  • 4
  • 20
  • 44
12
votes
3 answers

What is the preferred way to concatenate sequences in Python 3?

What is the preferred way to concatenate sequences in Python 3? Right now, I'm doing: import functools import operator def concatenate(sequences): return functools.reduce(operator.add, sequences) print(concatenate([['spam', 'eggs'],…
ToBeReplaced
  • 3,334
  • 2
  • 26
  • 42
11
votes
2 answers

Why does object.__new__ with arguments work fine in Python 2.x and not in Python 3.3+?

Why does the following code work fine in Python 2.x and not in Python 3.3+: class TestA(object): def __new__(cls, e): return super(TestA, cls).__new__(TestB, e) class TestB(TestA): def __init__(self, e): print(self,…
tbicr
  • 24,790
  • 12
  • 81
  • 106
11
votes
2 answers

ReferenceError: "something" is not defined in QML

I have Main.qml file like this: import QtQuick 2.0 Rectangle { color: ggg.Colors.notificationMouseOverColor width: 1024 height: 768 } in python file, i have this(i use form PyQt5): App = QGuiApplication(sys.argv) View =…
Vahid Kharazi
  • 5,723
  • 17
  • 60
  • 103
11
votes
2 answers

Get fatal error when install psycopg2

I created a virtual environment with virtualenvwrapper using Python 3. mkvirtualenv foo -p /usr/bin/python3 I tried to do a pip install of psycopg2 and got the following error: ./psycopg/psycopg.h:30:20: fatal error: Python.h: No such file or…
Rico
  • 5,692
  • 8
  • 46
  • 63
11
votes
7 answers

print two dimensional list

I have a list, in which is another list and I want to doc.write(a) a = [[1, 2, "hello"], [3, 5, "hi There"], [5,7,"I don't know"]] doc.write(''.join(a)) TypeError: sequence item 0: expected str instance, list found How can I handle…
inetphantom
  • 2,498
  • 4
  • 38
  • 61
11
votes
1 answer

How to update values to the listbox under Combobox in ttk Python33

When I create the Combobox, it has no items in the list. Now when I click on the dropdown button a function is called (via the postcommand option), but once in my function I don't know how to set the values in the listbox of the Combobox. Code…
Harvey
  • 2,062
  • 2
  • 21
  • 38
11
votes
4 answers

Application icon in PySide GUI

I have a PySide GUI app (written in Python 3, running on Windows 7 Pro) in which I’m setting the application icon as follows: class MyGui(QtGui.QWidget): def __init__(self): super(MyGui, self).__init__() ... …
Praetorian
  • 106,671
  • 19
  • 240
  • 328
10
votes
2 answers

Installing newest Python on openSUSE

I installed Python on an openSUSE system (see version below) using the Zypper package manager. This gives me Python 3.2, but some packages require Python 3.3. Updating with zypper update python3 stays on Python 3.2. How can I upgrade to 3.3, ideally…
clstaudt
  • 21,436
  • 45
  • 156
  • 239
10
votes
4 answers

Empty space in between rows after using writer in python

I am using csv package now, and every time when I write to a new csv file and open it with excel I will find a empty row in between every two rows. filereader = csv.reader(open("tests.csv", "r"), delimiter=",") filewriter =…
user1998777
  • 159
  • 1
  • 2
  • 10
10
votes
7 answers

How to choose a random line from a text file

I am trying to make a lottery program for my school (we have an economic system). My program generates numbers and saves it off into a text file. When I want to "pull" numbers out of my generator I want it to ensure that there is a winner. Q: How…
Marcello B.
  • 4,177
  • 11
  • 45
  • 65
10
votes
2 answers

How to convert some character into five digit unicode one in Python 3.3?

I'd like to convert some character into five digit unicode on in Python 3.3. For example, import re print(re.sub('a', u'\u1D15D', 'abc' )) but the result is different from what I expected. Do I have to put the character itself, not codepoint? Is…
user1610952
  • 1,249
  • 1
  • 16
  • 31