Re: Issues installing Python 2.7

2014-11-27 Thread Steven D'Aprano
On Wed, 26 Nov 2014 09:09:30 -0800, billyfurlong wrote: > ./configure --prefix=/opt/python2.7 --enable-shared Do you need to install to /opt instead of the default of /usr/local/bin? I have multiple versions of Python installed on a Red Hat system (Centos, but RH should be the same) using the d

Re: I love assert

2014-11-27 Thread TP
On Tue, Nov 11, 2014 at 11:40 AM, Peter Cacioppi wrote: > I get the impression that most Pythonistas aren't as habituated with > assert statements as I am. Is that just a misimpression on my part? If not, > is there a good reason to assert less with Python than other languages? > > As far as I ca

Re: I love assert

2014-11-27 Thread alister
On Thu, 27 Nov 2014 01:22:37 -0800, TP wrote: > On Tue, Nov 11, 2014 at 11:40 AM, Peter Cacioppi > > wrote: > >> I get the impression that most Pythonistas aren't as habituated with >> assert statements as I am. Is that just a misimpression on my part? If >> not, >> is there a good reason to ass

Db transactions and locking

2014-11-27 Thread Frank Millman
Hi all I just learned something about database transactions, locking, and DB-API 2.0. I wondered why a PostgreSQL statement was hanging. On investigation, it was waiting to acquire a lock. On further investigation, the lock was held by a simple SELECT statement. This surprised me. I got a clu

Re: Db transactions and locking

2014-11-27 Thread Chris Angelico
On Thu, Nov 27, 2014 at 9:24 PM, Frank Millman wrote: > "PostgreSQL by default commits between each statement unless you explicitly > start a transaction." > > All Python database adaptors that I have used start a transaction when you > open a cursor. I have just re-read DB-API 2.0, and I cannot s

Re: Fwd: Python Signal/Slot + QThred code analysis

2014-11-27 Thread Juan Christian
On Thu Nov 27 2014 at 2:12:40 AM Michael Torrie wrote: Hmm, I hit a wall. There's no main.ui file. Can you rework your code so that you have a single file (plus a separate ui file that's okay), that simulates the url request, that I can execute easily. As you asked, here it's, everything on one m

Asyncio problem, looking for advice.

2014-11-27 Thread Benjamin Risher
Hello all, I'm working on a project to learn asyncio and network programming. What I'm trying to do is forward a connection from myself to another machine. Kind of like an asynchronous python implementation of fpipe. In a nutshell: 1 --> start a server listening on localhost 2 --> connect

Where is path.py?

2014-11-27 Thread David Aldrich
Hi I am running Python 2.7 on Windows 8.1. Today I installed path.py using easy_install: easy_install path.py The example code that I've seen imports path.py as follows: from path import path I am fairly new to Python and have a few questions about this: 1) Why is 'from path'

Re: [ANN] Pylint 1.4 released

2014-11-27 Thread Ned Batchelder
On 11/23/14 4:45 AM, Claudiu Popa wrote: Hello! On behalf of the Pylint development team, I'm happy to announce that Pylint 1.4 has been released. This release has a lot of improvements over the last one. One of the main differences is that support for Python versions < 2.7 has been droped, whi

Re: Where is path.py?

2014-11-27 Thread MRAB
On 2014-11-27 14:10, David Aldrich wrote: Hi I am running Python 2.7 on Windows 8.1. Today I installed path.py using easy_install: easy_install path.py The example code that I've seen imports path.py as follows: from path import path I am fairly new to Python and have a few questions about t

Re: Where is path.py?

2014-11-27 Thread Dave Angel
On 11/27/2014 09:10 AM, David Aldrich wrote: Hi I am running Python 2.7 on Windows 8.1. Today I installed path.py using easy_install: easy_install path.py The example code that I've seen imports path.py as follows: from path import path I am fairly new to Python and have a f

RE: Where is path.py?

2014-11-27 Thread David Aldrich
> The syntax: >from import > will import the name from the module , so: > from path import path > will import the name 'path' (a class) from the module 'path'. Thanks. But I don't quite understand. If I use sys: import sys args = sys.argv[1:] I don't need to use 'from'. What i

Re: Where is path.py?

2014-11-27 Thread Chris Angelico
On Fri, Nov 28, 2014 at 2:30 AM, David Aldrich wrote: > Thanks. But I don't quite understand. If I use sys: > > import sys > > args = sys.argv[1:] > > I don't need to use 'from'. What is different with using path? You could instead say: from sys import argv args = argv[1:] The only confusing

RE: Where is path.py?

2014-11-27 Thread David Aldrich
> The only confusing bit here is that instead of "sys" and "argv", you have > "path" and "path", the same name twice. But it's the same thing happening. Thanks very much for all replies I received for my question. It's clearer now. By the way, for Windows users, I do recommend Microsoft's PTVS (P

Re: [Pylint-dev] [ANN] Pylint 1.4 released

2014-11-27 Thread Claudiu Popa
On Thu, Nov 27, 2014 at 5:19 PM, Ned Batchelder wrote: > On 11/23/14 4:45 AM, Claudiu Popa wrote: >> >> Hello! >> >> On behalf of the Pylint development team, I'm happy to announce that >> Pylint 1.4 has been released. >> >> This release has a lot of improvements over the last one. One of the >> m

Re: [code-quality] [ANN] Pylint 1.4 released

2014-11-27 Thread Julien Cristau
On Thu, Nov 27, 2014 at 10:19:28 -0500, Ned Batchelder wrote: > I found a problem with the new spell feature, but the issue tracker > (http://www.bytebucket.org/logilab/pylint/issues) seems broken: > everything I tried ended at a 403 CSRF validation failure page. > Not sure where that url came fr

How is max supposed to work, especially key.

2014-11-27 Thread Albert van der Horst
In the Rosetta code I come across this part of LU-decomposition. def pivotize(m): """Creates the pivoting matrix for m.""" n = len(m) ID = [[float(i == j) for i in xrange(n)] for j in xrange(n)] for j in xrange(n): row = max(xrange(j, n), key=lambda i: abs(m[i][j]))

Re: [ANN] PyUBL

2014-11-27 Thread Burak Arslan
On 11/26/14 08:53, dieter wrote: > Burak Arslan writes: >> We've gone through the grunt work of researching and integrating >> XMLDSIG, XAdES and UBL schemas and its various extensions and >> dependencies and wrote a bunch of scripts that map these documents to >> python objects. > In this contex

Re: How is max supposed to work, especially key.

2014-11-27 Thread Peter Otten
Albert van der Horst wrote: > In the Rosetta code I come across this part of > LU-decomposition. > > def pivotize(m): > """Creates the pivoting matrix for m.""" > n = len(m) > ID = [[float(i == j) for i in xrange(n)] for j in xrange(n)] > for j in xrange(n): > row = max(xr

Re: Db transactions and locking

2014-11-27 Thread Ian Kelly
On Nov 27, 2014 4:26 AM, "Frank Millman" wrote: > All Python database adaptors that I have used start a transaction when you > open a cursor. I have just re-read DB-API 2.0, and I cannot see anything > that specifies this behaviour, but AFAICT this is what happens. I don't know how others work, b

Re: [Pylint-dev] [code-quality] [ANN] Pylint 1.4 released

2014-11-27 Thread Michal Nowikowski
Hello, Just submitted pull request with a fix: https://bitbucket.org/logilab/pylint/pull-request/205/fixed-reading-list-of-ignored-words-for/diff Regards, Godfryd On Thu, Nov 27, 2014 at 7:00 PM, Ned Batchelder wrote: > On 11/27/14 11:59 AM, Julien Cristau wrote: > >> On Thu, Nov 27, 2014 at 1

Logging with unittest

2014-11-27 Thread Jared Windover
I've been working with unittest for a while and just started using logging, and my question is: is it possible to use logging to display information about the tests you're running, but still have it be compatible with the --buffer option so that you only see it if a test fails? It seems like it

Re: Db transactions and locking

2014-11-27 Thread Chris Angelico
On Fri, Nov 28, 2014 at 5:02 AM, Ian Kelly wrote: > On Nov 27, 2014 4:26 AM, "Frank Millman" wrote: >> All Python database adaptors that I have used start a transaction when you >> open a cursor. I have just re-read DB-API 2.0, and I cannot see anything >> that specifies this behaviour, but AFAIC

Re: Issues installing Python 2.7

2014-11-27 Thread Chris Angelico
On Fri, Nov 28, 2014 at 4:40 AM, Dennis Lee Bieber wrote: > On Thu, 27 Nov 2014 11:53:10 +1100, Steven D'Aprano > declaimed the following: > >>billyfurl...@gmail.com wrote: > >> >>> Add this to the bashrc >>> export PATH=$PATH:/opt/python2.7/bin/ >> >>I'm not so sure about that, but I don't have

Re: Fwd: Python Signal/Slot + QThred code analysis

2014-11-27 Thread Michael Torrie
On 11/27/2014 04:58 AM, Juan Christian wrote: > What I have in mind is simple (I think), have the Outpost get the data > using QThread, and when it got everything needed emit a signal. So when I > have something like 'var = Outpost('123')', when I get the signal I'll know > that I can call 'var.tra

Re: Fwd: Python Signal/Slot + QThred code analysis

2014-11-27 Thread Juan Christian
On Thu Nov 27 2014 at 8:53:16 PM Michael Torrie wrote: Hope this helps. Here's complete working code, minus the .ui file: http://pastebin.com/VhmSFX2t Thanks, I'll just repost the code on pastebin with a NEVER expire time and UNLISTED, so that it can be of some help for others here in the mailist

Re: Fwd: Python Signal/Slot + QThred code analysis

2014-11-27 Thread Juan Christian
On Thu Nov 27 2014 at 9:16:38 PM Juan Christian wrote: I'll read the code thoroughly and reply to you if I find something strange, many thanks! So, instantly I found one issue, you said that this code won't block the GUI, only the thread event loop, but if we keep moving the window while it's op

Re: Fwd: Python Signal/Slot + QThred code analysis

2014-11-27 Thread Michael Torrie
On 11/27/2014 04:29 PM, Juan Christian wrote: > So, instantly I found one issue, you said that this code won't block the > GUI, only the thread event loop, but if we keep moving the window while > it's open, every time new info is printed the GUI freezes for like 1-2 > seconds. Correct. The threa

Re: Fwd: Python Signal/Slot + QThred code analysis

2014-11-27 Thread Michael Torrie
On 11/27/2014 04:29 PM, Juan Christian wrote: > Is that right? But I don't think that always calling the site this way is > good for them and for me, sometimes I may not get new users for like 10~15 > minutes, so I would have wasted a lot of calls for nothing. That's why I > only instantiate/call t

Can you use self in __str__

2014-11-27 Thread Seymore4Head
def __str__(self): s = "Hand contains " for x in self.hand: s = s + str(x) + " " return s This is part of a Hand class. I need a hand for the dealer and a hand for the player. dealer=Hand() player=Hand() This prints out 'Hand contains " foo bar for both th

Re: Can you use self in __str__

2014-11-27 Thread Dave Angel
On 11/27/2014 08:26 PM, Seymore4Head wrote: def __str__(self): s = "Hand contains " for x in self.hand: s = s + str(x) + " " return s This is part of a Hand class. I need a hand for the dealer and a hand for the player. dealer=Hand() player=Hand()

Re: Can you use self in __str__

2014-11-27 Thread Shiyao Ma
2014-11-28 9:26 GMT+08:00 Seymore4Head : > def __str__(self): > s = "Hand contains " > for x in self.hand: > s = s + str(x) + " " > return s > > This is part of a Hand class. I need a hand for the dealer and a hand > for the player. > dealer=Hand() > player=

Re: Can you use self in __str__

2014-11-27 Thread Seymore4Head
On Thu, 27 Nov 2014 21:49:29 -0500, Dave Angel wrote: class Hand: def __init__(self): self.hand = [] # create Hand object def __str__(self): s = 'Hand contains ' for x in self.hand: s = s + str(x) + " " return s I am using 2.7 (Codesku

Re: Can you use self in __str__

2014-11-27 Thread Seymore4Head
On Fri, 28 Nov 2014 11:04:26 +0800, Shiyao Ma wrote: >2014-11-28 9:26 GMT+08:00 Seymore4Head : >> def __str__(self): >> s = "Hand contains " >> for x in self.hand: >> s = s + str(x) + " " >> return s >> >> This is part of a Hand class. I need a hand for th

Re: Fwd: Python Signal/Slot + QThred code analysis

2014-11-27 Thread Michael Torrie
On 11/27/2014 04:29 PM, Juan Christian wrote: > Is that right? But I don't think that always calling the site this way is > good for them and for me, sometimes I may not get new users for like 10~15 > minutes, so I would have wasted a lot of calls for nothing. That's why I > only instantiate/call t

Why is Smiling a Donation?

2014-11-27 Thread bv4bv4bv4
Why is Smiling a Donation? (And smiling to your brother is donation). This is what the greatest Prophet (All Prayers and Peace of Allah be upon him) said and this is what the latest researches are discovering, so let's read Researchers have studied about smiling influence on others. They h

Re: Can you use self in __str__

2014-11-27 Thread Chris Angelico
On Fri, Nov 28, 2014 at 2:04 PM, Shiyao Ma wrote: > What if it's in the local namespace of a function or method? IDK, try > to get that thing first. What if it's in multiple namespaces? What if it's not in any at all? Your solution is not going to work in the general case, AND it's a bad idea. Pl

Re: html page mail link to webmail program

2014-11-27 Thread Akira Li
Ethan Furman writes: > On 11/11/2014 05:08 PM, Ben Finney wrote: >> Ethan Furman writes: >> >>> My wife (using a Win7 machine) will be on a web page that has a link >>> to mail somebody. She clicks on it, and it opens the currently >>> installed but unused Thunderbird. >>> >>> Ideally, what wou

Re: Db transactions and locking

2014-11-27 Thread Frank Millman
"Dennis Lee Bieber" wrote in message news:4loe7at2ls7tfq0oe041ru9svvsm8ak...@4ax.com... > On Thu, 27 Nov 2014 12:24:39 +0200, "Frank Millman" > declaimed the following: > > >>All Python database adaptors that I have used start a transaction when you >>open a cursor. I have just re-read DB-API 2

Re: Curious function argument

2014-11-27 Thread Akira Li
"ast" writes: > Hello > > I saw in a code from a previous message in this forum > a curious function argument. > > def test(x=[0]): > print(x[0]) ## Poor man's object > x[0] += 1 > test() > 0 test() > 1 test() > 2 > > I understand that the author wants to implement a glo

Re: Db transactions and locking

2014-11-27 Thread Chris Angelico
On Fri, Nov 28, 2014 at 4:44 PM, Frank Millman wrote: > There seems to be a difference between conn.commit() and > cur.execute('commit'), which leaves the connection in a different state. Yes, if a connection library offers a way to commit/roll back, it's usually best to use that. > However, for

Re: Db transactions and locking

2014-11-27 Thread Frank Millman
"Frank Millman" wrote in message news:m5924d$nbq$1...@ger.gmane.org... > > > This seems to confirm what I thought, but then I continued, and was > surprised at the result. > > I can repeat these lines at will - > > cur.execute('SELECT * FROM mytable') - 4 > conn.commit() - 3 > > But if I do thi

Re: Db transactions and locking

2014-11-27 Thread Chris Angelico
On Fri, Nov 28, 2014 at 5:57 PM, Frank Millman wrote: > cur.execute('commit') tells the database to commit the transaction, but the > adaptor is not aware of this, so does not reset. Therefore the next command > does not trigger starting a new transaction. > > I have now learned another lesson - n

Re: Can you use self in __str__

2014-11-27 Thread Steven D'Aprano
Seymore4Head wrote: > On Fri, 28 Nov 2014 11:04:26 +0800, Shiyao Ma wrote: > >>2014-11-28 9:26 GMT+08:00 Seymore4Head : >>> def __str__(self): >>> s = "Hand contains " >>> for x in self.hand: >>> s = s + str(x) + " " >>> return s >>> >>> This is part of a