[Tutor] Unit test case

2013-02-22 Thread jitendra gupta
Hi, I am working one tool, which will do compile/run the workspace (that code is written on c/c++). on that my requirment is i need to compile subfolder also, i have wrote code for that also. My problem is , i am unable to write the Unit test case for that. Since my method (called run_subfolder)

Re: [Tutor] How to break long lines?

2013-02-22 Thread Dave Angel
On 02/22/2013 09:40 PM, Don Jennings wrote: On Feb 22, 2013, at 9:12 PM, tutor-requ...@python.org wrote: Message: 5 Date: Fri, 22 Feb 2013 21:03:00 -0500 From: Dave Angel Did you read the beginning of that digest? It said to make sure and rename the subect line. Tutor Digest isn't m

Re: [Tutor] Trying to avoid using eval..

2013-02-22 Thread eryksun
On Fri, Feb 22, 2013 at 9:11 PM, Rohit Mediratta wrote: > Heres the pseudo code of what I want to do: > > def rerun(testBlock) : > op = testBlock.split('.') > module = op[0] ; className = op[1] > reload(module) > # testBlock is a string, so it needs evaluation! > newObject = te

Re: [Tutor] object attribute validation

2013-02-22 Thread Steven D'Aprano
On 23/02/13 10:50, neubyr wrote: I would like to validate data attributes before the object is instantiated or any changes thereafter. For example, following is a simple Person class with name and age attributes. I would like to validate whether age is an integer before it is added/changed in the

Re: [Tutor] Trying to avoid using eval..

2013-02-22 Thread Steven D'Aprano
On 23/02/13 13:11, Rohit Mediratta wrote: Hi All, I want to reload my Module after I fix bugs and want to instantiate an object of a class contained in this module. Heres the pseudo code of what I want to do: def rerun(testBlock) : op = testBlock.split('.') module = op[0] ; clas

Re: [Tutor] How to break long lines?

2013-02-22 Thread eryksun
On Fri, Feb 22, 2013 at 6:46 PM, Steven D'Aprano wrote: > At worst, the string concatenation + operator will apply at runtime, > which for a short string like this is not a big deal. But in practice, > I would expect Python's "keyhole optimizer" to see that it is only > string literals being conca

Re: [Tutor] Tutor Digest, Vol 108, Issue 75

2013-02-22 Thread Don Jennings
On Feb 22, 2013, at 9:12 PM, tutor-requ...@python.org wrote: > Message: 5 > Date: Fri, 22 Feb 2013 21:03:00 -0500 > From: Dave Angel > To: tutor@python.org > Subject: Re: [Tutor] How to break long lines? > Message-ID: <51282354.3030...@davea.name> > Content-Type: text/plain; charset=ISO-8859-1;

Re: [Tutor] object attribute validation

2013-02-22 Thread Dave Angel
On 02/22/2013 09:26 PM, Robert Sjoblom wrote: I would like to validate data attributes before the object is instantiated or any changes thereafter. For example, following is a simple Person class with name and age attributes. [snip] Following is my example code: class Person(object): def __

Re: [Tutor] Trying to avoid using eval..

2013-02-22 Thread Mitya Sirenef
On 02/22/2013 09:11 PM, Rohit Mediratta wrote: Hi All, > I want to reload my Module after I fix bugs and want to instantiate an object of a class contained in this module. > > Heres the pseudo code of what I want to do: > > def rerun(testBlock) : > op = testBlock.split('.') > module = op[0] ; c

Re: [Tutor] object attribute validation

2013-02-22 Thread Robert Sjoblom
> I would like to validate data attributes before the object is instantiated > or any changes thereafter. For example, following is a simple Person class > with name and age attributes. [snip] Following is my > example code: > class Person(object): > def __init__(self,name,age): > self.name

[Tutor] Trying to avoid using eval..

2013-02-22 Thread Rohit Mediratta
Hi All, I want to reload my Module after I fix bugs and want to instantiate an object of a class contained in this module. Heres the pseudo code of what I want to do: def rerun(testBlock) : op = testBlock.split('.') module = op[0] ; className = op[1] reload(module) # testBloc

Re: [Tutor] How to break long lines?

2013-02-22 Thread Dave Angel
On 02/22/2013 08:22 PM, Jim Byrnes wrote: Thanks for giving me so many options to use in the future. When reading I completely blew by the single quote on a single line part. The db is sqlite3 and it seems happy with ''' strings. FWIW, there is absolutely no difference between a stri

Re: [Tutor] How to break long lines?

2013-02-22 Thread Jim Byrnes
On 02/22/2013 05:46 PM, Steven D'Aprano wrote: On 23/02/13 08:26, Jim Byrnes wrote: I am cleaning up my code and have a number of sqlite3 execute statements that extend far past 80 characters. From my reading implicit line joining with (), [] or {} seems to be the preferred method, but cur.ex

[Tutor] object attribute validation

2013-02-22 Thread neubyr
I would like to validate data attributes before the object is instantiated or any changes thereafter. For example, following is a simple Person class with name and age attributes. I would like to validate whether age is an integer before it is added/changed in the object's dictionary. I have taken

Re: [Tutor] How to break long lines?

2013-02-22 Thread Steven D'Aprano
On 23/02/13 08:26, Jim Byrnes wrote: I am cleaning up my code and have a number of sqlite3 execute statements that extend far past 80 characters. From my reading implicit line joining with (), [] or {} seems to be the preferred method, but cur.execute('SELECT Account FROM pwds WHERE Category

Re: [Tutor] How to break long lines?

2013-02-22 Thread Jim Byrnes
On 02/22/2013 03:59 PM, Jerry Hill wrote: On Fri, Feb 22, 2013 at 4:26 PM, Jim Byrnes wrote: I am cleaning up my code and have a number of sqlite3 execute statements that extend far past 80 characters. From my reading implicit line joining with (), [] or {} seems to be the preferred method, b

Re: [Tutor] How to break long lines?

2013-02-22 Thread Jim Byrnes
On 02/22/2013 03:54 PM, Prasad, Ramit wrote: Jim Byrnes wrote: I am cleaning up my code and have a number of sqlite3 execute statements that extend far past 80 characters. From my reading implicit line joining with (), [] or {} seems to be the preferred method, but cur.execute('SELECT Accoun

Re: [Tutor] How to break long lines?

2013-02-22 Thread Prasad, Ramit
Jim Byrnes wrote: > I am cleaning up my code and have a number of sqlite3 execute statements > that extend far past 80 characters. > > From my reading implicit line joining with (), [] or {} seems to be the > preferred method, but > > cur.execute('SELECT Account FROM pwds WHERE Category=? ORDER

Re: [Tutor] How to break long lines?

2013-02-22 Thread Jerry Hill
On Fri, Feb 22, 2013 at 4:26 PM, Jim Byrnes wrote: > I am cleaning up my code and have a number of sqlite3 execute statements > that extend far past 80 characters. > > From my reading implicit line joining with (), [] or {} seems to be the > preferred method, but > > cur.execute('SELECT Account FR

Re: [Tutor] How to break long lines?

2013-02-22 Thread Mitya Sirenef
On 02/22/2013 04:26 PM, Jim Byrnes wrote: I am cleaning up my code and have a number of sqlite3 execute statements that extend far past 80 characters. > > From my reading implicit line joining with (), [] or {} seems to be the preferred method, but > > cur.execute('SELECT Account FROM pwds WH

[Tutor] How to break long lines?

2013-02-22 Thread Jim Byrnes
I am cleaning up my code and have a number of sqlite3 execute statements that extend far past 80 characters. From my reading implicit line joining with (), [] or {} seems to be the preferred method, but cur.execute('SELECT Account FROM pwds WHERE Category=? ORDER BY Account COLLATE NO

Re: [Tutor] sqlite3 does it support limit in a delete clause?

2013-02-22 Thread Jim Byrnes
On 02/21/2013 11:10 PM, eryksun wrote: On Thu, Feb 21, 2013 at 8:47 PM, Jim Byrnes wrote: cur.execute("delete from pwds where Account='xMe' limit 1") If you need a alternate way to limit the delete, try the following, for which the limit is on a select query: cur.execute(''' de

Re: [Tutor] sqlite3 does it support limit in a delete clause?

2013-02-22 Thread eryksun
On Thu, Feb 21, 2013 at 10:41 PM, eryksun wrote: > However, I'm surprised it's disabled in Ubuntu since Debian's > Python 2.7.3 has it. I took a moment to look at the changelogs. The option to use LIMIT with DELETE was added in SQLite 3.6.4 (Oct 2008): http://www.sqlite.org/changes.html#version_