On Wed, Apr 29, 2015 at 5:49 PM, Peter Otten <__pete...@web.de> wrote:
> boB Stepp wrote:
>> So I have stumbled (With your gracious help!) into a legitimate use of
>> eval()?
>
> No. To expand on Marks hint here's how to do it without evil eval().
>
> import operator
>
> comps = {
> "=": opera
On Wed, Apr 29, 2015 at 4:42 PM, Mark Lawrence wrote:
> This isn't a job for Bicycle Repair Man!!!
Not even if we only use the latest, greatest,
computer-aided bicycle repair technology???
> ... It smacks to me of dictionaries
> and the operator module but I'm too bone idle to look it up mysel
Hi Bob,
By the way, it sounds like you're starting to learn about how to write
interpreters. If that's the case, you might find PLAI helpful:
http://cs.brown.edu/~sk/Publications/Books/ProgLangs/
helpful. (Full disclosure: the author was my external advisor. :P)
Another good book is EoP
boB Stepp wrote:
> On Wed, Apr 29, 2015 at 3:46 PM, Marc Tompkins
> wrote:
>> On Wed, Apr 29, 2015 at 1:10 PM, boB Stepp
>> wrote:
>>>
>>> Python 2.4.4, Solaris 10.
>>>
>>> I have some functions that I believe I could collapse into a single
>>> function if I only knew how:
>>>
>>> def choose_com
I forget. You are writing these things as functions rather than
methods of a class, because you don't know how to use classes yet?
Because you are absolutely correct that there are ways to simplify this,
but if you don't know how to use classes yet, put this on hold until
you do. And this partic
On 29/04/2015 21:10, boB Stepp wrote:
Python 2.4.4, Solaris 10.
I have some functions that I believe I could collapse into a single
function if I only knew how:
def choose_compare(operator, value0, value1, pass_color, fail_color):
"""
Perform the comparison indicated by operator. Retu
On Wed, Apr 29, 2015 at 3:50 PM, Laura Creighton wrote:
> I forget. You are writing these things as functions rather than
> methods of a class, because you don't know how to use classes yet?
You forget nothing! ~(:>))
> Because you are absolutely correct that there are ways to simplify this,
>
On Wed, Apr 29, 2015 at 3:46 PM, Marc Tompkins wrote:
> On Wed, Apr 29, 2015 at 1:10 PM, boB Stepp wrote:
>>
>> Python 2.4.4, Solaris 10.
>>
>> I have some functions that I believe I could collapse into a single
>> function if I only knew how:
>>
>> def choose_compare(operator, value0, value1, pa
On Wed, Apr 29, 2015 at 1:10 PM, boB Stepp wrote:
> Python 2.4.4, Solaris 10.
>
> I have some functions that I believe I could collapse into a single
> function if I only knew how:
>
> def choose_compare(operator, value0, value1, pass_color, fail_color):
> """
> Perform the comparison ind
Python 2.4.4, Solaris 10.
I have some functions that I believe I could collapse into a single
function if I only knew how:
def choose_compare(operator, value0, value1, pass_color, fail_color):
"""
Perform the comparison indicated by operator. Return pass_color if
true, fail_color if false
10 matches
Mail list logo