Re: [Tutor] Writing to the terminal?

2010-12-17 Thread Karim
I suppose we can do something like that (kind of pseudo code) to fully configure it: def doSomeStuff(*args): ... def progressBar( func, *args) import time, sys f = sys.stdout for i in range(20): func.__call__(args) f.write('=') f.fl

Re: [Tutor] Writing to the terminal?

2010-12-17 Thread Karim
Hello Steven, I added the pipe char '|' to have a complete spinner! This would be set as a function for my wait routine installer. Thanks to share! Karim On 12/10/2010 09:51 PM, Steven D'Aprano wrote: Modulok wrote: List, Forgive me if I don't describe this well, I'm new to it: [snip des

Re: [Tutor] The Template Pattern

2010-12-17 Thread Karim
Hello Steven, Could take some time when possible to answer to my follow-up question? Thank you! Cheers Karim On 12/14/2010 12:19 AM, Karim wrote: On 12/13/2010 11:47 PM, Steven D'Aprano wrote: Karim wrote: Hello all, I am seeking for information about the template pattern applied to pyth

Re: [Tutor] unit testing - Separate methods or group tests together?

2010-12-17 Thread Steven D'Aprano
Modulok wrote: List, When you create unit tests, do you group tests for a given function together into one unit test method, or do you prefer to have separate test methods for every assert statement? Each test method should test one thing. That doesn't necessarily mean one assert, but one con

Re: [Tutor] calling setters of superclasses

2010-12-17 Thread Alan Gauld
"Gregory, Matthew" wrote class PositiveX(object): def __init__(self): @property def x(self): @x.setter def x(self, val): I don't use properties in Python very often (hardly ever in fact) and I've never used @setter so there may be naming requirements I'm not aware of. But i

[Tutor] unit testing - Separate methods or group tests together?

2010-12-17 Thread Modulok
List, When you create unit tests, do you group tests for a given function together into one unit test method, or do you prefer to have separate test methods for every assert statement? Thanks! -Modulok- ___ Tutor maillist - Tutor@python.org To unsubsc

Re: [Tutor] os.system

2010-12-17 Thread Steven D'Aprano
jtl999 wrote: I want to pass a variable to os.system which is dir dir=raw_input ("Dir Please ") Dir Please / ok dir = / os.system ("ls" + dir) sh: ls/: No such file or directory 32512 any advice Yes -- learn to read the error messages you get. The error you get is a shell error, not a P

Re: [Tutor] os.system

2010-12-17 Thread wesley chun
On Fri, Dec 17, 2010 at 4:17 PM, Emile van Sebille wrote: > On 12/17/2010 4:07 PM jtl999 said... >> >> I want to pass a variable to os.system which is dir > dir=raw_input ("Dir Please ") > os.system ("ls"  + dir) >> sh: ls/: No such file or directory > > this has concatenated "ls" and dir

[Tutor] calling setters of superclasses

2010-12-17 Thread Gregory, Matthew
Hi all, Consider the following classes where PositiveX should constrain the attribute _x to be positive and SmallX should further constrain the attribute _x to be less than 10. class PositiveX(object): def __init__(self): self._x = 1 @property def x(self): return sel

Re: [Tutor] os.system

2010-12-17 Thread Emile van Sebille
On 12/17/2010 4:07 PM jtl999 said... I want to pass a variable to os.system which is dir dir=raw_input ("Dir Please ") Dir Please / ok dir = / os.system ("ls" + dir) sh: ls/: No such file or directory this has concatenated "ls" and dir try with "ls " Emile 32512 any advice __

[Tutor] os.system

2010-12-17 Thread jtl999
I want to pass a variable to os.system which is dir >>> dir=raw_input ("Dir Please ") Dir Please / ok dir = / >>> os.system ("ls" + dir) sh: ls/: No such file or directory 32512 any advice signature.asc Description: This is a digitally signed message part _

Re: [Tutor] vim as a python editor; FOLLOW-UP QUESTION

2010-12-17 Thread Joel Schwartz
Thanks for all the good advice guys! Joel > -Original Message- > From: tutor-bounces+joel=joelschwartz@python.org > [mailto:tutor-bounces+joel=joelschwartz@python.org] On > Behalf Of Alan Gauld > Sent: Thursday, December 16, 2010 4:27 PM > To: tutor@python.org > Subject: Re: [Tu

Re: [Tutor] Looking for a tutor to review my code and provide constructive feedback.

2010-12-17 Thread Steven D'Aprano
zicu radu wrote: Hello, How to prevent shadows a built-in in code. Please if you are kind enougth to take the time to provide feedback I would appreciate that it is constructive. The script is here: http://bpaste.net/show/12364/ Are you sure you have posted the right link? This is a functi

[Tutor] Looking for a tutor to review my code and provide constructive feedback.

2010-12-17 Thread zicu radu
Hello, How to prevent shadows a built-in in code. Please if you are kind enougth to take the time to provide feedback I would appreciate that it is constructive. The script is here: http://bpaste.net/show/12364/ ___ Tutor maillist - Tutor@python.org

Re: [Tutor] How to import python dictionary into MySQL table?

2010-12-17 Thread Peter Otten
Sean Carolan wrote: >> I have a database with a table called "systems" that contains an >> auto-increment id field, as well as fields for each of the keys in >> mydata.keys(). But I can't seem to get the syntax to import >> mydata.values() into the table. I think the problem may be that some >>