Forwarding to the list with my reply...
On Fri, Jan 23, 2009 at 1:35 PM, spir wrote:
> Le Fri, 23 Jan 2009 06:45:04 -0500,
> Kent Johnson a écrit :
>
>> On Fri, Jan 23, 2009 at 6:04 AM, spir wrote:
>>
>> > Thank you Alan and sorry for not having been clear enough. The point
>> > actually was c
On Fri, Jan 23, 2009 at 6:04 AM, spir wrote:
> Thank you Alan and sorry for not having been clear enough. The point actually
> was class (definition) attributes. I thought at e.g. Guido's views that lists
> were for homogeneous sequences as opposed to tuples rather like records. And
> a way to
Le Thu, 22 Jan 2009 23:29:59 -,
"Alan Gauld" a écrit :
>
> "Alan Gauld" wrote
>
> >> is there a way to give arguments to a class definition?
>
> I see that Kent interpreted your question differently to me.
> If you do mean that you want to dynamically define class
> attributes rather
"Alan Gauld" wrote
is there a way to give arguments to a class definition?
I see that Kent interpreted your question differently to me.
If you do mean that you want to dynamically define class
attributes rather than instance attributes then __init__()
won't work. But I'd be interested to
On Thu, Jan 22, 2009 at 5:18 PM, Kent Johnson wrote:
> On Thu, Jan 22, 2009 at 4:51 PM, spir wrote:
>> Hello,
>>
>> is there a way to give arguments to a class definition? Eg
>>
>> class MonoList(list, typ, number):
>>item_type = typ
>>item_number = number
>
> Use the type() funct
On Thu, Jan 22, 2009 at 4:51 PM, spir wrote:
> Hello,
>
> is there a way to give arguments to a class definition? Eg
>
> class MonoList(list, typ, number):
>item_type = typ
>item_number = number
Use the type() function (which is the constructor for the type 'type')
to dynamically
"spir" wrote
is there a way to give arguments to a class definition? Eg
class MonoList(list, typ, number):
item_type = typ
item_number = number
Yes thats what the __init__ method is for.
class MonoList:
def __init__(self, lst, typ, num):
self.item_type = typ
self.number = num
Hello,
is there a way to give arguments to a class definition? Eg
class MonoList(list, typ, number):
item_type = typ
item_number = number
[I guess you understand what I try to do...]
denis
--
la vida e estranya
___
Tutor maillist