I didn't do a good job of explaining it cos I didn't want it to be a TLDR; but
I could've added a little more. To clarify:
Expr is just a way to represent simple arithmetic expressions for a calculator.
Because the expression has to be modified and built over time, and evaluated
from left to
On Wednesday, July 10, 2013 12:20:47 AM UTC+2, Ian wrote:
On Tue, Jul 9, 2013 at 4:18 PM, Ian Kelly ian.g.ke...@gmail.com wrote:
If you actually want to modify the current object, you would need to
do something like:
def expand(self):
import copy
On 7/10/2013 4:58 AM, Russel Walker wrote:
There is the name x and the class instance (the object) which exists
somewhere in memory that x points to. self is just another name that
points to the same object (not self in general but the argument
passed to the self parameter when a method is
On Wednesday, July 10, 2013 9:33:25 PM UTC+2, Terry Reedy wrote:
On 7/10/2013 4:58 AM, Russel Walker wrote:
There is the name x and the class instance (the object) which exists
somewhere in memory that x points to. self is just another name that
points to the same object (not self
I've been mucking around with this silly class pretty much the whole day and my
eyes are about closing now so this is the solution for now I think. Please feel
free to drop any suggestions. I think I mostly just ended up shaving off allot
of extraneous responsibility for the class, that and
On Wed, Jul 10, 2013 at 4:50 PM, Russel Walker russ.po...@gmail.com wrote:
def append(self, x):
if len(self) 3:
list.append(self, x)
else:
oldself = LRExpression(*self)
self.__init__(oldself)
self.append(x)
It's probably
On Tue, Jul 9, 2013 at 4:01 PM, Russel Walker russ.po...@gmail.com wrote:
Sorry for the vague title. Probably best to just show you the code that
explains it better.
This is a simplified example of what I want to do:
# THIS DOESN'T WORK
from random import choice
class Expr(object):
On Tue, Jul 9, 2013 at 4:18 PM, Ian Kelly ian.g.ke...@gmail.com wrote:
If you actually want to modify the current object, you would need to
do something like:
def expand(self):
import copy
self.expr = Expr(self.expr, self.op, self.val)
self.op = choice('+-*/')
On 07/09/2013 06:01 PM, Russel Walker wrote:
Sorry for the vague title. Probably best to just show you the code that
explains it better.
This is a simplified example of what I want to do:
# THIS DOESN'T WORK
from random import choice
class Expr(object):
Expr(expr, op, val) - an
On 07/09/2013 03:01 PM, Russel Walker wrote:
This is a simplified example of what I want to do:
# THIS DOESN'T WORK
from random import choice
class Expr(object):
Expr(expr, op, val) - an expression object.
def __init__(self, expr, op='', val=''):
self.expr =
10 matches
Mail list logo