Marco Bizzarri wrote:
Just a question: "generic functions" are not meant in the sense of
"generic functions" of CLOS, am I right?
>>
it's meant in exactly that sense: len(L) means "of all len() implementations
available to the runtime, execute the most specific code we have for the
object L".
On Sep 6, 8:02 am, "Marco Bizzarri" <[EMAIL PROTECTED]> wrote:
> On Fri, Sep 5, 2008 at 9:16 PM, Bruno Desthuilliers
>
> <[EMAIL PROTECTED]> wrote:
> > Marco Bizzarri a écrit :
>
> >> Just a question: "generic functions" are not meant in the sense of
> >> "generic functions" of CLOS, am I right?
>
On Sat, Sep 6, 2008 at 7:52 AM, Fredrik Lundh <[EMAIL PROTECTED]> wrote:
> Marco Bizzarri wrote:
>
>>> (...as Bruno implies, setattr(), len() et al can be and should be viewed
>>> as
>>> generic functions.
>>
>> Just a question: "generic functions" are not meant in the sense of
>> "generic function
On Fri, Sep 5, 2008 at 9:16 PM, Bruno Desthuilliers
<[EMAIL PROTECTED]> wrote:
> Marco Bizzarri a écrit :
>>
>> Just a question: "generic functions" are not meant in the sense of
>> "generic functions" of CLOS, am I right?
>
> Nope. Just "generic" in the sense that they accept any object implementi
Marco Bizzarri wrote:
(...as Bruno implies, setattr(), len() et al can be and should be viewed as
generic functions.
Just a question: "generic functions" are not meant in the sense of
"generic functions" of CLOS, am I right?
it's meant in exactly that sense: len(L) means "of all len()
imple
Marco Bizzarri a écrit :
On Thu, Sep 4, 2008 at 10:47 AM, Fredrik Lundh <[EMAIL PROTECTED]> wrote:
(...as Bruno implies, setattr(), len() et al can be and should be viewed as
generic functions.
Just a question: "generic functions" are not meant in the sense of
"generic functions" of CLOS, am
On Thu, Sep 4, 2008 at 10:47 AM, Fredrik Lundh <[EMAIL PROTECTED]> wrote:
>
> (...as Bruno implies, setattr(), len() et al can be and should be viewed as
> generic functions.
Just a question: "generic functions" are not meant in the sense of
"generic functions" of CLOS, am I right?
--
Marco Biz
2008/9/4 Fredrik Lundh <[EMAIL PROTECTED]>:
> Bruno Desthuilliers wrote:
>
>> You wouldn't write something like 2.__add__(3), would you ?
>
> Don't give the "it's only OO if I write obj.method(args)" crowd more bad
> ideas, please ;-)
>
> (...as Bruno implies, setattr(), len() et al can be and shou
In article <[EMAIL PROTECTED]>,
Bruno Desthuilliers <[EMAIL PROTECTED]> wrote:
>Mathieu Prevot a écrit :
>> 2008/9/4 Chris Rebert <[EMAIL PROTECTED]>:
>
>(snip)
>
>>> You're looking for the setattr() built-in function. In this exact case:
>>>setattr(a, arg, new_value)
>>>
>>> This is probably
Bruno Desthuilliers wrote:
> You wouldn't write something like 2.__add__(3), would you ?
Don't give the "it's only OO if I write obj.method(args)" crowd more bad
ideas, please ;-)
(...as Bruno implies, setattr(), len() et al can be and should be viewed
as generic functions. A specific Pytho
Mathieu Prevot <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I have a program that take a word as argument, and I would like to
> link this word to a class variable.
>
> eg.
> class foo():
>width = 10
>height = 20
>
> a=foo()
> arg='height'
> a.__argname__= new_value
Not quite sure what
Mathieu Prevot a écrit :
2008/9/4 Chris Rebert <[EMAIL PROTECTED]>:
(snip)
You're looking for the setattr() built-in function. In this exact case:
setattr(a, arg, new_value)
This is probably covered in the Python tutorial, please read it.
Regards,
Chris
Indeed.
I'll use:
a.__setattr__
Mathieu Prevot wrote:
I'll use:
a.__setattr__(height, new_value)
that's an implementation detail. please use setattr() instead, like
everyone else.
--
http://mail.python.org/mailman/listinfo/python-list
2008/9/4 Chris Rebert <[EMAIL PROTECTED]>:
> On Thu, Sep 4, 2008 at 12:25 AM, Mathieu Prevot
> <[EMAIL PROTECTED]> wrote:
>> Hi,
>>
>> I have a program that take a word as argument, and I would like to
>> link this word to a class variable.
>>
>> eg.
>> class foo():
>
> You should subclass 'object'
En Thu, 04 Sep 2008 04:25:37 -0300, Mathieu Prevot
<[EMAIL PROTECTED]> escribi�:
I have a program that take a word as argument, and I would like to
link this word to a class variable.
eg.
class foo():
width = 10
height = 20
a=foo()
arg='height'
a.__argname__= new_value
rather than :
if
Mathieu Prevot wrote:
I have a program that take a word as argument, and I would like to
link this word to a class variable.
eg.
class foo():
width = 10
height = 20
a=foo()
arg='height'
a.__argname__= new_value
rather than :
if arg == 'height':
a.height = new_value
elif arg == 'width';
On Thu, Sep 4, 2008 at 12:25 AM, Mathieu Prevot
<[EMAIL PROTECTED]> wrote:
> Hi,
>
> I have a program that take a word as argument, and I would like to
> link this word to a class variable.
>
> eg.
> class foo():
You should subclass 'object', so that should be:
class Foo(object):
> width = 1
Hi,
I have a program that take a word as argument, and I would like to
link this word to a class variable.
eg.
class foo():
width = 10
height = 20
a=foo()
arg='height'
a.__argname__= new_value
rather than :
if arg == 'height':
a.height = new_value
elif arg == 'width';
a.width = new_val
18 matches
Mail list logo