[RELEASED] Python 3.2.4 rc 1 and Python 3.3.1 rc 1

2013-03-25 Thread Georg Brandl
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On behalf of the Python development team, I am pleased to announce the first release candidates of Python 3.2.4 and 3.3.1. Python 3.2.4 will be the last regular maintenance release for the Python 3.2 series, while Python 3.3.1 is the first maintenance

Re: At a loss on python scoping.

2013-03-25 Thread Chris Angelico
On Tue, Mar 26, 2013 at 5:17 PM, Shiyao Ma wrote: > class A: > r = 5 > def func(self, s): > self.s = s > a = A() > print(a.r)# this should print 5, but where does py store the name of r What do you mean by "the name of r"? ChrisA -- http://mail.python.org/mailman/listinfo/py

Re: Performance of int/long in Python 3

2013-03-25 Thread Chris Angelico
On Tue, Mar 26, 2013 at 10:35 AM, Cousin Stanley wrote: > > Chris Angelico wrote: > >> The Python 3 merge of int and long has effectively penalized >> small-number arithmetic by removing an optimization. >> >> The cost is clear. >> > > The cost isn't quite as clear > under Debian Whe

Re: At a loss on python scoping.

2013-03-25 Thread Shiyao Ma
PS, I now python's scoping rule is lexical rule (aka static rule). How does LEGB apply to class? On Tue, Mar 26, 2013 at 2:17 PM, Shiyao Ma wrote: > Hi, > suppose I have a file like this: > class A: > r = 5 > def func(self, s): > self.s = s > a = A() > print(a.r)# this should

Re: python3 string format

2013-03-25 Thread Ian Kelly
On Mon, Mar 25, 2013 at 10:24 PM, Shiyao Ma wrote: > HI. > one thing confuses me. > It is said in the pep3101 that "{}".format (x) will invoke the method > x.__format__ > However, I looked at the src of python3 and found: > in class str(object), the format simply contains a pass statement > in cla

At a loss on python scoping.

2013-03-25 Thread Shiyao Ma
Hi, suppose I have a file like this: class A: r = 5 def func(self, s): self.s = s a = A() print(a.r)# this should print 5, but where does py store the name of r a.func(3) print(a.s)# this should print 3, also where does py store this name. what's the underlying difference b

Re: Performance of int/long in Python 3

2013-03-25 Thread Chris Angelico
On Tue, Mar 26, 2013 at 4:01 PM, Steven D'Aprano > No string methods? You were lucky. When I were a lad, you couldn't even > use "" delimiters for strings. > "b string" > Parsing error: file , line 1: > "b string" > ^ > Unhandled exception: run-time error: syntax error > > > Python 0.9.1. We

Re: Performance of int/long in Python 3

2013-03-25 Thread Steven D'Aprano
On Mon, 25 Mar 2013 20:55:03 -0400, Roy Smith wrote: > In article <5150e900$0$29998$c3e8da3$54964...@news.astraweb.com>, > Steven D'Aprano wrote: > >> Also, speaking as somebody who remembers a time when ints where not >> automatically promoted to longs (introduced in, Python 2.2, I think?) >>

python3 string format

2013-03-25 Thread Shiyao Ma
HI. one thing confuses me. It is said in the pep3101 that "{}".format (x) will invoke the method x.__format__ However, I looked at the src of python3 and found: in class str(object), the format simply contains a pass statement in class int(object), things is the same. So, what's the mechanism that

Re: Separate Rows in reader

2013-03-25 Thread MRAB
On 26/03/2013 03:33, Jiewei Huang wrote: On Tuesday, March 26, 2013 11:40:51 AM UTC+10, Dave Angel wrote: On 03/25/2013 09:05 PM, Jiewei Huang wrote: On Monday, March 25, 2013 11:51:51 PM UTC+10, rusi wrote: If you insist on using GoogleGroups, then make sure you keep your quotes small. I'm

Re: import in Python3.3

2013-03-25 Thread rocky
On Sunday, March 24, 2013 8:27:56 PM UTC-4, Steven D'Aprano wrote: > On Sun, 24 Mar 2013 18:12:49 -0500, Fabian von Romberg wrote: > > > > > Hi, > > > > > > I have a package name collections and inside of my package I want to > > > import the collections package from the standard library, bu

Re: Separate Rows in reader

2013-03-25 Thread Jiewei Huang
On Tuesday, March 26, 2013 11:40:51 AM UTC+10, Dave Angel wrote: > On 03/25/2013 09:05 PM, Jiewei Huang wrote: > > > On Monday, March 25, 2013 11:51:51 PM UTC+10, rusi wrote: > > > > If you insist on using GoogleGroups, then make sure you keep your quotes > > small. I'm about to stop readin

Re: io.BytesIO

2013-03-25 Thread Fabian von Romberg
Hi Steve, thanks for your reply. Actually I played around with these methods. Whe you truncate(12468) for example, I thought the object would allocate 12468 bytes and I wanted to get that back. The methods your mention, works only for what ha been written (obj.write()). I think I should use

Re: Separate Rows in reader

2013-03-25 Thread Dave Angel
On 03/25/2013 09:05 PM, Jiewei Huang wrote: > On Monday, March 25, 2013 11:51:51 PM UTC+10, rusi wrote: If you insist on using GoogleGroups, then make sure you keep your quotes small. I'm about to stop reading messages that are double-spaced by buggy software. Have you tried the spl

Re: Separate Rows in reader

2013-03-25 Thread Jiewei Huang
On Monday, March 25, 2013 11:51:51 PM UTC+10, rusi wrote: > On Mar 25, 11:52 am, Jiewei Huang wrote: > > > On Sunday, March 24, 2013 9:10:45 PM UTC+10, ypsun wrote: > > > > Jiewei Huang於 2013年3月24日星期日UTC+1上午6時20分29秒寫道: > > > > > > > > Hi all, > > > > > > > > Currently create a simple text-ba

Re: Performance of int/long in Python 3

2013-03-25 Thread Roy Smith
In article <5150e900$0$29998$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > Also, speaking as somebody who remembers a time when ints where not > automatically promoted to longs (introduced in, Python 2.2, I think?) let > me say that having a single unified int type is *fantasti

Re: Performance of int/long in Python 3

2013-03-25 Thread Oscar Benjamin
On 26 March 2013 00:17, Steven D'Aprano wrote: > On Mon, 25 Mar 2013 16:16:05 -0700, Ethan Furman wrote: > [snip] >> If you're working with >> numbers, and speed is an issue, you really should be using one of the >> numeric or scientific packages out there. > [snip] > What I would like to see thou

Re: Performance of int/long in Python 3

2013-03-25 Thread Chris Angelico
On Tue, Mar 26, 2013 at 11:17 AM, Steven D'Aprano wrote: > Also, speaking as somebody who remembers a time when ints where not > automatically promoted to longs (introduced in, Python 2.2, I think?) let > me say that having a single unified int type is *fantastic*, and managing > ints/longs by han

Re: Performance of int/long in Python 3

2013-03-25 Thread Steven D'Aprano
On Mon, 25 Mar 2013 16:16:05 -0700, Ethan Furman wrote: > On 03/25/2013 02:51 PM, Chris Angelico wrote: >> Python 3's int is faster than Python 2's long, but slower than Python >> 2's int. So the question really is, would a two-form representation be >> beneficial, and if so, is it worth the codin

Re: Performance of int/long in Python 3

2013-03-25 Thread Cousin Stanley
Chris Angelico wrote: > The Python 3 merge of int and long has effectively penalized > small-number arithmetic by removing an optimization. > > The cost is clear. > The cost isn't quite as clear under Debian Wheezy here Stanley C. Kitching Debian Wheezy python inlin

Re: Help me pick an API design (OO vs functional)

2013-03-25 Thread Mitya Sirenef
On 03/25/2013 03:29 PM, Michael Herrmann wrote: Hello everyone, my name is Michael, I'm the lead developer of a Python GUI automation library for Windows called Automa: http://www.getautoma.com. We want to add some features to our library but are unsure how to best expose them via our API. It

Re: Performance of int/long in Python 3

2013-03-25 Thread Dan Stromberg
On Mon, Mar 25, 2013 at 4:35 PM, Cousin Stanley wrote: > > Chris Angelico wrote: > > > The Python 3 merge of int and long has effectively penalized > > small-number arithmetic by removing an optimization. > > > > The cost is clear. > > > I thought I heard that Python 3.x will use machin

Re: Performance of int/long in Python 3

2013-03-25 Thread Ethan Furman
On 03/25/2013 02:51 PM, Chris Angelico wrote: Python 3's int is faster than Python 2's long, but slower than Python 2's int. So the question really is, would a two-form representation be beneficial, and if so, is it worth the coding trouble? I'm inclined to say it's not worth the trouble. If y

Re: Help me pick an API design (OO vs functional)

2013-03-25 Thread Ethan Furman
On 03/25/2013 12:29 PM, Michael Herrmann wrote: Hello everyone, my name is Michael, I'm the lead developer of a Python GUI automation library for Windows called Automa: http://www.getautoma.com. We want to add some features to our library but are unsure how to best expose them via our API. It

Performance of int/long in Python 3

2013-03-25 Thread Chris Angelico
The Python 3 merge of int and long has effectively penalized small-number arithmetic by removing an optimization. As we've seen from PEP 393 strings (jmf aside), there can be huge benefits from having a single type with multiple representations internally. Is there value in making the int type have

Re: Help me pick an API design (OO vs functional)

2013-03-25 Thread Chris Angelico
On Tue, Mar 26, 2013 at 7:48 AM, Michael Herrmann wrote: > On Monday, March 25, 2013 8:42:25 PM UTC+1, Kwpolska wrote: >> ... >> >> > notepad_1 = start("Notepad") >> > notepad_2 = start("Notepad") >> > with notepad_1: >> > write("Hello World!") >> >

Re: How to define "exec" method on a class object? Get syntax error due to built in command

2013-03-25 Thread Chris Angelico
On Tue, Mar 26, 2013 at 7:28 AM, Kyle wrote: > I am using swig to generate our CLI for TCL and Python. In this CLI, we have > a subcommand "exec" that is failing to compile in the python case. There > seems to be some built-in python command "exec" which is giving a syntax > error in the .py fi

Re: Help me pick an API design (OO vs functional)

2013-03-25 Thread Michael Herrmann
Hi Kwpolska, thanks for your reply (as last time I posted here!). On Monday, March 25, 2013 8:42:25 PM UTC+1, Kwpolska wrote: > ... > > > notepad_1 = start("Notepad") > > notepad_2 = start("Notepad") > > with notepad_1: > > write("Hello World!") > >

How to define "exec" method on a class object? Get syntax error due to built in command

2013-03-25 Thread Kyle
I am using swig to generate our CLI for TCL and Python. In this CLI, we have a subcommand "exec" that is failing to compile in the python case. There seems to be some built-in python command "exec" which is giving a syntax error in the .py file generated by swig when I try to import it: def

Re: Help me pick an API design (OO vs functional)

2013-03-25 Thread Kwpolska
On Mon, Mar 25, 2013 at 8:29 PM, Michael Herrmann wrote: > notepad_1 = start("Notepad") > notepad_2 = start("Notepad") > notepad_1.write("Hello World!") > notepad_1.press(CTRL + 'a', CTRL + 'c') > notepad_2.press(CTRL + 'v') Explicit is better than implicit

Python 2.7.3 + Docutils + Cygwin = Aborted?

2013-03-25 Thread Tim Daneliuk
I've asked this question on the Docutils list but there seems to be no obvious Docutils problem, so I'll ask here If I do this: python rst2latex.py foo.latex It works BUT python ends with an "Aborted" message and an empty python2.7.exe.stackdump. The practical problem here is that the

Help me pick an API design (OO vs functional)

2013-03-25 Thread Michael Herrmann
Hello everyone, my name is Michael, I'm the lead developer of a Python GUI automation library for Windows called Automa: http://www.getautoma.com. We want to add some features to our library but are unsure how to best expose them via our API. It would be extremely helpful for us if you could l

Re: Separate Rows in reader

2013-03-25 Thread rusi
On Mar 25, 11:52 am, Jiewei Huang wrote: > On Sunday, March 24, 2013 9:10:45 PM UTC+10, ypsun wrote: > > Jiewei Huang於 2013年3月24日星期日UTC+1上午6時20分29秒寫道: > > > > Hi all, > > > > Currently create a simple text-based database of information about people > > > > I have a csv file which consist of 3 rows

Re: Python 2.7.3 tempfile.py, ln34, from random import Random as _Random

2013-03-25 Thread dbv
I have a number of .py source files and one source file has an "import random" and another has "import werkzeug". The project works perfectly in the Python interpreter. Problem appears when using PyInstaller. How do get out of jail? -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 2.7.3 tempfile.py, ln34, from random import Random as _Random

2013-03-25 Thread Dave Angel
On 03/25/2013 08:29 AM, dbv wrote: In Python 2.7.3, at ln34 the source file tempfile.py states: from random import Random as _Random But, Random is a Class. Have you just tried the following: import random print dir(random.random) print random.__file__ I suspect you have another r

Re: Python 2.7.3 tempfile.py, ln34, from random import Random as _Random

2013-03-25 Thread Peter Otten
dbv wrote: > In Python 2.7.3, at ln34 the source file tempfile.py states: > > from random import Random as _Random > > But, Random is a Class. This is not a problem. You can import arbitrary objects from a module. > The project imports werkzeug and using PyInstaller, the Traceback is: > > T

Python 2.7.3 tempfile.py, ln34, from random import Random as _Random

2013-03-25 Thread dbv
In Python 2.7.3, at ln34 the source file tempfile.py states: from random import Random as _Random But, Random is a Class. The project imports werkzeug and using PyInstaller, the Traceback is: Traceback (most recent call last): File "", line 9, in File "/home/ubuntu/Programs/pyinstaller-2.

ANN: eGenix mxODBC 3.2.2 - Python ODBC Database Interface

2013-03-25 Thread eGenix Team: M.-A. Lemburg
ANNOUNCING eGenix.com mxODBC Python ODBC Database Interface Version 3.2.2 mxODBC is our commercially supported Python extension providing