[Tutor] module.class.method in logging.debug

2010-03-15 Thread Brian Jones
Hi all, I have some code that is a plugin for a larger app, and I'd like to be able to properly log issues that arise in the plugin code. I may not be maintaining this code forever, and I'd like the logging to work even if it's refactored later and code moved around, method names change, etc. So I

Re: [Tutor] module.class.method in logging.debug

2010-03-15 Thread Brian Jones
On Mon, Mar 15, 2010 at 1:26 PM, Brian Jones wrote: > Hi all, > > I have some code that is a plugin for a larger app, and I'd like to be able > to properly log issues that arise in the plugin code. I may not be > maintaining this code forever, and I'd like the log

[Tutor] What's the best way to ask forgiveness here?

2010-09-13 Thread Brian Jones
I've been coding Python long enough that 'asking forgiveness instead of permission' is my first instinct, but the resulting code is sometimes clumsy, and I wonder if someone can suggest something I'm missing, or at least validate what's going on here in some way. What I'm trying to do is write a f

Re: [Tutor] What's the best way to ask forgiveness here?

2010-09-13 Thread Brian Jones
Thanks for the replies so far. One thing that's probably relevant: once a directory is created, I can expect to write a couple of hundred files to it, so doing a 'try os.makedirs' right off the bat strikes me as coding for the *least* common case instead of the *most* common (which is that the dire

Re: [Tutor] input and raw input

2010-09-25 Thread Brian Jones
On Sat, Sep 25, 2010 at 9:40 AM, Evert Rol wrote: > > any one have an idea about how we can input many number in the one time > and change it to list. > > for example: > > > > a=input("Enter the number of your class in the school:") # the number > can be enter as: 12,13,14 or 12 13 14 with a

Re: [Tutor] dynamic arrays?

2010-09-27 Thread Brian Jones
On Mon, Sep 27, 2010 at 11:32 AM, Alex Hall wrote: > Hi all, > One thing I have never much liked about Python is its need for > specifically sized arrays and lack of a dynamic, array-like data > structure. For example, the following fails with a "list assignment > index out of range" error: > > a

Re: [Tutor] function with multiple checks

2010-09-27 Thread Brian Jones
On Mon, Sep 27, 2010 at 11:09 AM, Tim Miller wrote: > I've got a small function that I'm using to check whether a password is of > a certain length and contains mixed case, numbers and punctuation. > > Originally I was using multiple "if re.search" for the patterns but it > looked terrible so I'v

Re: [Tutor] dynamic arrays?

2010-09-27 Thread Brian Jones
On Mon, Sep 27, 2010 at 11:39 AM, Alex Hall wrote: > On 9/27/10, Brian Jones wrote: > > On Mon, Sep 27, 2010 at 11:32 AM, Alex Hall wrote: > > > >> Hi all, > >> One thing I have never much liked about Python is its need for > >> specifically sized arr

Re: [Tutor] function with multiple checks

2010-09-27 Thread Brian Jones
On Mon, Sep 27, 2010 at 11:43 AM, Brian Jones wrote: > > > On Mon, Sep 27, 2010 at 11:09 AM, Tim Miller wrote: > >> I've got a small function that I'm using to check whether a password is of >> a certain length and contains mixed case, numbers and punctua

Re: [Tutor] IDE for Python

2010-10-09 Thread Brian Jones
On Thu, Oct 7, 2010 at 11:23 AM, Juan Jose Del Toro wrote: > Dear List; > > In your experience what is the best IDE for Python? > > I've used SPE and IDLE, I've also seen people using Eclipse but which one > do you recommend? > There is no 'best for Python'. IDEs are made to please people, not l

Re: [Tutor] Stumped Again

2010-10-30 Thread Brian Jones
On Sat, Oct 30, 2010 at 7:12 PM, Terry Green wrote: > *Am running this Script and cannot figure out how to close my files,* > > *Keep getting msg: Attribute Error: ‘_csv.writer’ object has no attribute > ‘close’* > > *Why?* > Because csv.writer objects don't have a close() method. Files do :)

[Tutor] oo design/interaction quandary

2009-12-25 Thread Brian Jones
Hi all, I'm having a design issue that's really bothering me. The code I'm writing is fairly large by now, but I've written what I think is a decent example that illustrates my problem. My app launches threads that each consume messages from a queue, send them to a processor object, and then the

[Tutor] send os.system() output to tarfile?

2007-08-07 Thread Brian Jones
Hi all, I've been lurking on this list for some time. It's great. Thanks for all the help. I'm a sysadmin by trade, and have slowly started using Python more and more in my work. However, this is my first experience with using the tarfile module. I'm currently writing a script to backup a mysql