Re: [Tutor] "Ctrl-C (unix)" in python

2009-02-18 Thread Jervis Whitley
On Thu, Feb 19, 2009 at 9:44 AM, pa yo wrote: > I am running my Twitter>>Wiki bots in infinite loops but can't find > an easy way to turn them off gracefully once I have started them. At > the moment I have to go into the terminal window where they are > running and type "Ctrl-C". (I am running U

Re: [Tutor] regex: not start with FOO

2009-02-02 Thread Jervis Whitley
On Tue, Feb 3, 2009 at 9:46 AM, Bernard Rankin wrote: > Hello, > > > I'd like to match any line that does not start with FOO. (Using just a > reg-ex rule) > > 1) What is the effective difference between: > > (?!^FOO).* > > ^(?!FOO).* > > 2) Is there a better way to do this? > myline = 'FOO thin

Re: [Tutor] Properties of an object

2009-01-29 Thread Jervis Whitley
> > > > For me, the "()" look like artificial, not necessary. I would prefer just > to type"a.list_1stpart" , a property. > > > > -- > > Others have explained their preference for using get methods for accessing internal data structures, However it does look like you have specifically mention

Re: [Tutor] running & debugging in python interactive she

2009-01-15 Thread Jervis Whitley
On Fri, Jan 16, 2009 at 9:56 AM, Che M wrote: > > > > >> I'd like to add to this question and expand it: can anyone point me to > >> a good resource on debugging *generally*? > > The first result on "Debugger tutorial" on google sent me to this: > > > http://www.cs.princeton.edu/~benjasik/gdb/gd

Re: [Tutor] single key ordered sequence

2009-01-15 Thread Jervis Whitley
On Fri, Jan 16, 2009 at 10:39 AM, bob gailer wrote: > Jervis Whitley wrote: > >> >> >> On Fri, Jan 16, 2009 at 9:15 AM, Kent Johnson > ken...@tds.net>> wrote: >> >>On Thu, Jan 15, 2009 at 3:44 PM, Jervis Whitley >>mailto:jervi...@gmail

Re: [Tutor] single key ordered sequence

2009-01-15 Thread Jervis Whitley
On Fri, Jan 16, 2009 at 9:15 AM, Kent Johnson wrote: > On Thu, Jan 15, 2009 at 3:44 PM, Jervis Whitley > wrote: > > how about this: > > items = [(1,'a'),(1,'b'),(2,'a'),(3,'a'), > > (3,'b'),(4,'a&#x

Re: [Tutor] single key ordered sequence

2009-01-15 Thread Jervis Whitley
On Fri, Jan 16, 2009 at 4:56 AM, Senthil Kumaran wrote: > > Also, how to practically walk in reverse order in a list without > > copying it (e.g. items[::-1]), > > especially if i need both indexes and items (couldn't find with > > enumerate()). > > > Are you looking for reversed()? > The way you

Re: [Tutor] eval and floating point

2009-01-14 Thread Jervis Whitley
On Thu, Jan 15, 2009 at 1:19 PM, Mr Gerard Kelly wrote: > Thanks very much > > I've noticed that the eval() function gives an integer, so eval("3/2") > gives back 1. float(eval("3/2")) doesn't seem to work, any way to get a > floating point number back with eval()? > > I know you can just do ("3.

[Tutor] Fwd: Gamma distribution function

2009-01-13 Thread Jervis Whitley
-- Forwarded message -- From: Jervis Whitley Date: Wed, Jan 14, 2009 at 9:26 AM Subject: Re: [Tutor] Gamma distribution function To: culpritNr1 On Wed, Jan 14, 2009 at 9:11 AM, culpritNr1 wrote: > > The python documentation on this functionality is extremely poor

Re: [Tutor] Gamma distribution function

2009-01-13 Thread Jervis Whitley
On Wed, Jan 14, 2009 at 8:27 AM, culpritNr1 wrote: > > > there some kind of random.poisson()? > > Thank you, > > culpritNr1 > > Hello try the scipy library: >>> from scipy import stats >>> lamb = 10 >>> stats.distributions.poisson.rvs(lamb, loc=0) array([5]) >>> stats.distributions.poisson.rvs(la

Re: [Tutor] Question regarding win32com getting ldap object

2009-01-05 Thread Jervis Whitley
On Mon, Jan 5, 2009 at 8:04 PM, vishwajeet singh wrote: > Hi List, > > I am running following code to get ldap com object but the result I am > getting is unknown > I am using Python 25 and win32 bindings available at > http://downloads.sourceforge.net/pywin32/pywin32-212.win32-py2.2.exe?modtime=1

Re: [Tutor] Better way - fnmatch with list ? CORRECTION

2009-01-02 Thread Jervis Whitley
On Sat, Jan 3, 2009 at 10:48 AM, bob gailer wrote: > bob gailer wrote: >> >> >> for fn in files: >> base, ext = os.path.splitext(fn) >> if ext in ['.flac','.mp3','.m4a']: ## CORRECTION removed * >> >> > for fn in files: base, ext = os.path.splitext(fn) if ext.lower() in ['.flac', '.mp3'

Re: [Tutor] Exception Handling

2008-12-30 Thread Jervis Whitley
On Wed, Dec 31, 2008 at 11:18 AM, David wrote: > > . I still need to get it to prduce an error if the year is 0 or 2009, the > month is 0 or 13 and the day is 0 or 32. Try using the datetime module to check validity of entered data. example: >>> import datetime >>> datetime.datetime(2008, 12,

Re: [Tutor] Exception Handling

2008-12-30 Thread Jervis Whitley
On Wed, Dec 31, 2008 at 8:33 AM, David wrote: > On Mon, 29 Dec 2008 16:57:44 +0100, spir wrote: >> >> > On Mon, 29 Dec 2008 09:10:45 - >>> > "Alan Gauld" wrote: >>> > > >>> >> "bob gailer" wrote >> > >> > Also IMHO it is bad design to put a lot of code inside a try