Re: [Tutor] class arguments?

2009-01-23 Thread spir
Le Thu, 22 Jan 2009 23:29:59 -, Alan Gauld alan.ga...@btinternet.com a écrit : Alan Gauld alan.ga...@btinternet.com 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

Re: [Tutor] class arguments?

2009-01-23 Thread Kent Johnson
On Fri, Jan 23, 2009 at 6:04 AM, spir denis.s...@free.fr 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.

Re: [Tutor] class arguments?

2009-01-23 Thread Kent Johnson
Forwarding to the list with my reply... On Fri, Jan 23, 2009 at 1:35 PM, spir denis.s...@free.fr wrote: Le Fri, 23 Jan 2009 06:45:04 -0500, Kent Johnson ken...@tds.net a écrit : On Fri, Jan 23, 2009 at 6:04 AM, spir denis.s...@free.fr wrote: Thank you Alan and sorry for not having been

Re: [Tutor] class arguments?

2009-01-22 Thread Alan Gauld
spir denis.s...@free.fr 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

Re: [Tutor] class arguments?

2009-01-22 Thread Kent Johnson
On Thu, Jan 22, 2009 at 5:18 PM, Kent Johnson ken...@tds.net wrote: On Thu, Jan 22, 2009 at 4:51 PM, spir denis.s...@free.fr 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

Re: [Tutor] class arguments?

2009-01-22 Thread Alan Gauld
Alan Gauld alan.ga...@btinternet.com 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.