Re: Specifying __slots__ in a dynamically generated type

2005-03-27 Thread Steven Bethard
Ron Garret wrote: In article <[EMAIL PROTECTED]>, Steven Bethard <[EMAIL PROTECTED]> wrote: Why don't you just write a function to create class objects? def f(*params): class C(...): ... # based on params return C I suppose I could. When I originally started writing this code I w

Re: Specifying __slots__ in a dynamically generated type

2005-03-27 Thread Ron Garret
In article <[EMAIL PROTECTED]>, Steven Bethard <[EMAIL PROTECTED]> wrote: > Ron Garret wrote: > > I need to dynamically generate new types at run time. I can do this in > > two ways. I can use the "type" constructor, or I can generate a "class" > > statement as a string and feed that to the e

Re: Specifying __slots__ in a dynamically generated type

2005-03-27 Thread Ron Garret
In article <[EMAIL PROTECTED]>, Leif K-Brooks <[EMAIL PROTECTED]> wrote: > Ron Garret wrote: > > I need to dynamically generate new types at run time. I can do this in > > two ways. I can use the "type" constructor, or I can generate a "class" > > statement as a string and feed that to the ex

Re: Specifying __slots__ in a dynamically generated type

2005-03-27 Thread Leif K-Brooks
Ron Garret wrote: I need to dynamically generate new types at run time. I can do this in two ways. I can use the "type" constructor, or I can generate a "class" statement as a string and feed that to the exec function. The former technique is much cleaner all else being equal, but I want to b

Re: Specifying __slots__ in a dynamically generated type

2005-03-27 Thread François Pinard
[Ron Garret] > Is it really impossible to specify __slots__ using the "type" > constructor? It does not work? I vaguely remember having needed to do this once or twice, and it worked immediatly as expected. Unless I remember wrongly, you only have to preset `__slots__' in the dict you give to `

Re: Specifying __slots__ in a dynamically generated type

2005-03-27 Thread Steven Bethard
Ron Garret wrote: I need to dynamically generate new types at run time. I can do this in two ways. I can use the "type" constructor, or I can generate a "class" statement as a string and feed that to the exec function. The former technique is much cleaner all else being equal, but I want to b

Re: Specifying __slots__ in a dynamically generated type

2005-03-27 Thread Diez B. Roggisch
Ron Garret wrote: > > I need to dynamically generate new types at run time. I can do this in > two ways. I can use the "type" constructor, or I can generate a "class" > statement as a string and feed that to the exec function. The former > technique is much cleaner all else being equal, but I

Specifying __slots__ in a dynamically generated type

2005-03-27 Thread Ron Garret
I need to dynamically generate new types at run time. I can do this in two ways. I can use the "type" constructor, or I can generate a "class" statement as a string and feed that to the exec function. The former technique is much cleaner all else being equal, but I want to be able to specif