On Mon, 13 Jun 2005 15:52:14 +0200, =?ISO-8859-1?Q?Xavier_D=E9coret?= <[EMAIL
PROTECTED]> wrote:
<...OTT [OT Title] posted text snipped.../>
assignation != assignment ;-)
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
Xavier Décoret a écrit :
> Bruno Desthuilliers a écrit :
>
(snip)
>> I really wonder what it can be ???
>
> It's the ability to develop the equivalent of GeoNext (and much more) in
> Python with a very nice syntax.
This is nice, but this does not explain the why of your code snippet.
>>
>> Y
"Xavier Décoret" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>> class A( object):
>> def __init__(self, value):
>> self.value = value
>More seriously, try to do this with your simpler approach.
>a = A(4)
>b = A(lambda : a.x+5)
>a.x = 2
>print b.x # I want this to be 7, not
Bruno Desthuilliers a écrit :
> Xavier Décoret a écrit :
> (snip)
>
>> What I wanted to do is something like this:
>>
>> def change(x,v):
>> x = v
>>
>> class A(object):
>> def __init__(self,v):
>> self.x = v
>>
>> a = A(3)
>> print a.x # displays 3
>> change(a.x,4)
>> print a.x
Xavier Décoret a écrit :
(snip)
> What I wanted to do is something like this:
>
> def change(x,v):
> x = v
>
> class A(object):
> def __init__(self,v):
> self.x = v
>
> a = A(3)
> print a.x # displays 3
> change(a.x,4)
> print a.x # still displays 3
>
>
> It may seem weird,
On 13.06.2005, at 19:23, Terry Reedy wrote:
>
> "harold fellermann" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>
>> if you write
> a=A()
>> an instance of class A is created and bound to the local identifier
>> 'a'.
>
> I think it perhaps better to think of the label 'a' b
"harold fellermann" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>if you write
> >>> a=A()
>an instance of class A is created and bound to the local identifier 'a'.
I think it perhaps better to think of the label 'a' being bound to the
object rather than vice versa. For one,
Xavier Décoret wrote:
> What I wanted to do is something like this:
>
> def change(x,v):
> x = v
>
> class A(object):
> def __init__(self,v):
> self.x = v
>
> a = A(3)
> print a.x # displays 3
> change(a.x,4)
> print a.x # still displays 3
How about this?
def change(x, v):
Xavier Décoret a écrit :
> I would like to know if there is for python's classes an equivalent of
> the operator= that can be overidden.
>
> Let's say I have
> >>> a=A()
> and I want to write
> >>> a=5
> and I want this to change some internal value of a instead of making a
> point to a new ob
On Mon, Jun 13, 2005 at 03:52:14PM +0200, Xavier Décoret wrote:
> In other word, I would like to be able to use a=5 instead of a.set(5)
If a(5) is acceptable to you in stead of a=5
you can make your instance callable with the __call__ method:
class A(object):
def __init__(self):
self
On Mon, 13 Jun 2005 15:52:14 +0200, Xavier Décoret wrote:
> I would like to know if there is for python's classes an equivalent of
> the operator= that can be overidden.
>
> Let's say I have
> >>> a=A()
> and I want to write
> >>> a=5
> and I want this to change some internal value of a instea
On 13.06.2005, at 15:52, Xavier Décoret wrote:
> I would like to know if there is for python's classes an equivalent of
> the operator= that can be overidden.
>
> Let's say I have
a=A()
> and I want to write
a=5
> and I want this to change some internal value of a instead of making a
>
Xavier Décoret wrote:
> I would like to know if there is for python's classes an equivalent of
> the operator= that can be overidden.
>
> Let's say I have
> >>> a=A()
> and I want to write
> >>> a=5
> and I want this to change some internal value of a instead of making a
> point to a new objec
13 matches
Mail list logo