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
9
votes
2 answers

Given a method, how do I return the class it belongs to in Python 3.3 onward?

Given x = C.f after: class C: def f(self): pass What do I call on x that will return C? The best I could do is execing a parsed portion of x.__qualname__, which is ugly: exec('d = ' + ".".join(x.__qualname__.split('.')[:-1])) For a use…
Neil G
  • 32,138
  • 39
  • 156
  • 257
9
votes
1 answer

Python3: TypeError: unhashable type: 'list' when using Counter

I am using Python 3 and I have this code: from collections import Counter c = Counter([r[1] for r in results.items()]) But when I run it I get this error: Traceback (most recent call last): File "", line 1, in c =…
TJ1
  • 7,578
  • 19
  • 76
  • 119
9
votes
3 answers

How to raise an exception in Python 3.3

I am currently reading tutorials in tutorialspoint's python tutorials. But it's the tutorial of Python 2 not Python 3.3 which I have right now. Well, I managed to search in the internet and found out about some changes. But this one is pretty…
James
  • 103
  • 1
  • 2
  • 6
9
votes
2 answers

How do I print in Python 3.3.3 without carriage return?

First of all, I am NOT looking for how to print in the same line with the print(some_stuff, end=""). In Python 2.7 you could type: while True: for i in ["/","-","|","\\","|"]: print "%s\r" % i, and it would print, in the SAME line, in the SAME…
RGS
  • 964
  • 2
  • 10
  • 27
9
votes
4 answers

Getting certificate chain with Python 3.3 SSL module

I can get the standard certificate information for an SSL connection in Python 3.3 via the getpeercert() method on the SSL socket. However, it doesn't seem to provide the chain like OpenSSL's "s_client" tool does. Is there some way I can get this so…
Dustin Oprea
  • 9,673
  • 13
  • 65
  • 105
9
votes
2 answers

Tkinter Not Found

I'm running Windows 7 32-bit. I've installed Python 3.2.2 and selected every module for installation (including Tcl/Tk). On my computer, I can run a script by double-clicking the .py file and it will find my Tkinter import just fine. If I run it…
CodeMonkey
  • 1,795
  • 3
  • 16
  • 46
9
votes
1 answer

Installing Python 3.3 on Cygwin

I'm having trouble installing Python 3.3 on Cygwin. I've tried installing from source, but make returns: gcc -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I. -IInclude -I./Include -DPy_BUILD_CORE -c…
David Y. Stephenson
  • 872
  • 4
  • 22
  • 44
9
votes
2 answers

Python console and text output from Ping including \n\r

I dont know what is happening, but when I am printing to the console or to a text file, the newline (\n) is not functioning but rather showing in the string. Any idea how to avoid this in both the console and the text file? My code: import…
mad5245
  • 394
  • 3
  • 8
  • 20
8
votes
3 answers

Determine a file's path(s) relative to a directory, including symlinks

I have a directory with thousands of descendants (at least 1,000, probably no more than 20,000). Given a file path (which is guaranteed to exist), I want to know where that file can be found inside that directory -- including via symlinks. For…
Thom Smith
  • 13,916
  • 6
  • 45
  • 91
8
votes
1 answer

subprocess stdin buffer not flushing on newline with bufsize=1

I have two small python files, the first reads a line using input and then prints another line a = input() print('complete') The second attempts to run this as a subprocess import subprocess proc = subprocess.Popen('./simp.py', …
Ryan Haining
  • 35,360
  • 15
  • 114
  • 174
8
votes
3 answers

Redis Error 8 connecting localhost:6379. nodename nor servname provided, or not known

My environment is Mac OS 10.9.2, python3.3, redis-2.6.9 (64-bit). I have many threads (nealy 2000) that use the same redis instance to write data, but some threads throw the following exceptions: During handling of the above exception, another…
flyer
  • 9,280
  • 11
  • 46
  • 62
8
votes
3 answers

subprocess popen.communicate() vs. stdin.write() and stdout.read()

I have noticed two different behaviors with two approaches that should have result in the same outcome. The goal - to execute an external program using subprocess module, send some data and read the results. The external program is PLINK, platform…
izac89
  • 3,790
  • 7
  • 30
  • 46
8
votes
1 answer

Accessing nested dictionary items in Python

I am trying to format a string using an item from a nested dictionary (below) people = { 'Alice': { 'phone': '2341', 'addr': '87 Eastlake Court' }, 'Beth': { 'phone': '9102', …
KPM
  • 737
  • 4
  • 11
  • 20
8
votes
1 answer

Using pySerial with Python 3.3

I've seen many code samples using the serial port and people say they are working codes too. The thing is, when I try the code it doesn't work. import serial ser = serial.Serial( port=0, baudrate=9600 # parity=serial.PARITY_ODD, #…
P_Rein
  • 500
  • 1
  • 6
  • 16
8
votes
1 answer

Argparse: How to accept arguments that have different "types"

I want to accept arguments in the following style: python3 test.py -r SERVICE=100,101,102 -r SERVICE2=1,2,3,4,5 (-r REPO=REV#,REV#,etc... -r etc...) I've done the following so far (added the argument -r and defined the type revs). It's supposed to…
imagineerThat
  • 5,293
  • 7
  • 42
  • 78