Re: [Tutor] How to group data?

2011-02-13 Thread C or L Smith
>>temp_values1 = >> (x.pop(9))+(x.pop(8))+(x.pop(7))+(x.pop(6))+(x.pop(5))+(x.pop(4))+(x.pop(3))+(x.pop(2))+(x.pop(1))+(x.pop(0)) >> temp_values2 = >> (x.pop(19))+(x.pop(18))+(x.pop(17))+(x.pop(16))+(x.pop(15))+(x.pop(14))+(x.pop(13))+(x.pop(12))+(x.pop(11))+(x.pop(10)) When you pop a valu

Re: [Tutor] Math: integers to a fractional power (Matthew Denaburg)

2010-11-15 Thread C or L Smith
If you are interested in a symbolic solution or numerical solution without missing any of the possible roots (real or imaginary) you could check out sympy, a CAS that offers a quartic solution. It uses appropriate simplifications besides a general solution to the quartic. The code for this is i

Re: [Tutor] List comprehension question

2010-11-09 Thread C or L Smith
>> 1. Re: List comprehension question (Richard D. Moores) >>> ?: def proper_divisors_sum(n): >>> A few questions--noting, of course, that I'm not reading this with >>> an eye toward performance, which it seems you are, but these occur >>> to me: Tim Peters had a beautiful little version of divi

Re: [Tutor] tokenize problem on string literal?

2009-10-25 Thread C or L Smith
C or L Smith wrote: > Am I misunderstanding a tokenize parse rule or is this an error: > > ### > def tok(s): > import tokenize > from StringIO import StringIO > t = StringIO(s).readline > for ti in tokenize.generate_tokens(t): >

[Tutor] tokenize problem on string literal?

2009-10-25 Thread C or L Smith
Am I misunderstanding a tokenize parse rule or is this an error: ### def tok(s): import tokenize from StringIO import StringIO t = StringIO(s).readline for ti in tokenize.generate_tokens(t): print ti tok("'''quote: \") ### produces (3, "'''quote: '''", (1, 0), (1, 13)

Re: [Tutor] Python 2.3.5 question

2009-09-23 Thread C or L Smith
>> Hello. I am Roman. I bought this book call Python Programming for >> the Absolute Beginner which I am and after I downloaded Python 2.3.5 >> from their CD, I opened IDLE, typed "Game Over" and nothing >> happened. What do I do? Please, help. I don't understand any of the >> programming jargon. P

[Tutor] : breaking out of a function that takes too long

2009-09-16 Thread C or L Smith
>> Serdar wrote: ... >> So again, is there a way to place a time limit on the execution of a >> function, after which you can break out of it and then retry it or >> move along with the rest of your program? At http://tinyurl.com/rbre9n you can find a recipe that tells you how to decorate a funct

Re: [Tutor] (no subject)

2009-09-09 Thread C or L Smith
What about range(0, -n, -1) ? >>> That would need to have a starting value of -1 and an end value of >>> -(len(phrase)+1). Of else you can start at length - 1, end at zero >>> and a step value of -1. >> >> Another option, using "normal" range values but negative indexing is >> >> for

Re: [Tutor] Parsing Bible verses

2009-05-23 Thread C or L Smith
Here is something from my toolbox of routines that might be useful for the number ranges: >>> indices('-5--2') [-5, -4, -3, -2] >>> indices('3-4') [3, 4] >>> indices('3-4,10') [3, 4, 10] /chris def indices(s,n=None): #("1-3,7")->1,2,3,7;i("1,-3--1")->1,-3,-2,-1; or (slc,n=None)->slc.start,stop

Re: [Tutor] Advanced String Search using operators AND, OR etc..

2009-05-04 Thread C or L Smith
>> From: Alex Feddor >> >> I am looking for method enables advanced text string search. Method >> string.find() or re module seems no supporting what I am looking >> for. The idea is as follows: >> >> Text ="FDA meeting was successful. New drug is approved for whole >> sale distribution!" >> >

[Tutor] how to make classes play well together

2009-04-10 Thread C or L Smith
Unum is a module that allows one to handle units with numbers, e.g. 3*M -> 3 [m], a measurement of 3 meters. I have a module that I wrote some time ago that handles uncertainties with numbers as they are involved with calculations. Let's call it the pnum module (for physical numbers) e.g. pnum(

Re: [Tutor] documentation/sourceforge bug help

2006-10-30 Thread C or L Smith
Danny Yoo wrote: | On Mon, 30 Oct 2006, C or L Smith wrote: | || Can anyone help me figure out how to actually get logged in so I can || file the report? | | Do you happen to have cookies disabled? You might need to enable | them, since that's what SF will use to track your login status.

[Tutor] documentation/sourceforge bug help

2006-10-30 Thread C or L Smith
I know this is off topic, but can anyone give me a hand? I have a sourceforge account. I want to make a correction to the python documentation. I click on the appropriate link at the bottom of the documentation page and then the bug tracker link on the page that I am sent to which takes me to