Re: Meta Class Maybe?

2023-07-24 Thread Dom Grigonis via Python-list
> On 23 Jul 2023, at 02:12, Chris Nyland via Python-list > wrote: > > So I am stuck on a problem. I have a class which I want to use to create > another class without having to go through the boiler plate of subclassing. > Specifically because the subclass needs to have certain class attribute

Re: Meta Class Maybe?

2023-07-23 Thread Dieter Maurer via Python-list
Chris Nyland wrote at 2023-7-22 19:12 -0400: >So I am stuck on a problem. I have a class which I want to use to create >another class without having to go through the boiler plate of subclassing. Do you know about `__init_subclass__`? It is called whenever a class is subclassed and can be used to

Meta Class Maybe?

2023-07-22 Thread Chris Nyland via Python-list
So I am stuck on a problem. I have a class which I want to use to create another class without having to go through the boiler plate of subclassing. Specifically because the subclass needs to have certain class attributes and I would like to control how those are passed to provide defaults and such

Re: meta-class review

2010-10-06 Thread Ethan Furman
Carl Banks wrote: On Oct 5, 4:17 pm, Ethan Furman wrote: class DashInt(int): __metaclass__ = Perpetuate def __str__(x): if x == 0: return '-' return int.__str__(x) Well, it's definitely overkill for printing a dash instead of a zero, but a lot of peopl

Re: meta-class review

2010-10-06 Thread Jorgen Grahn
On Wed, 2010-10-06, Ethan Furman wrote: > MRAB wrote: >> On 06/10/2010 00:17, Ethan Furman wrote: >> > [snip] >> > Any comments appreciated, especially ideas on how to better handle >> > class- and staticmethods >> > >> I think that's a bit of overkill. The problem lies in the printing >> part,

Re: meta-class review

2010-10-06 Thread Carl Banks
On Oct 5, 4:17 pm, Ethan Furman wrote: > On one the many mini-reports we use, we have a bunch of counts that are > frequently zero; because the other counts can also be low, it becomes > easy to miss the non-zero counts.  For example: > > Code  Description > >        Conv Errors              :    

Re: meta-class review

2010-10-05 Thread Ethan Furman
MRAB wrote: On 06/10/2010 00:17, Ethan Furman wrote: > [snip] > Any comments appreciated, especially ideas on how to better handle > class- and staticmethods > I think that's a bit of overkill. The problem lies in the printing part, but you're spreading the solution into the rest of the appli

Re: meta-class review

2010-10-05 Thread MRAB
On 06/10/2010 00:17, Ethan Furman wrote: > On one the many mini-reports we use, we have a bunch of counts that > are frequently zero; because the other counts can also be low, it > becomes easy to miss the non-zero counts. For example: > > Code Description > > Conv Errors :

meta-class review

2010-10-05 Thread Ethan Furman
On one the many mini-reports we use, we have a bunch of counts that are frequently zero; because the other counts can also be low, it becomes easy to miss the non-zero counts. For example: Code Description Conv Errors : 6 31,N DPV Failure : 4 10:

Re: meta-class troubles

2010-08-30 Thread Ethan Furman
Chris Rebert wrote: Shouldn't meta= instead be metaclass= ? Xavier Ho wrote: > I think you need to have metaclass in the class statement, not just meta. Argh. Thank you both. I'm glad it was simple! ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: meta-class troubles

2010-08-30 Thread Xavier Ho
Actually, scrape what I said. I think you need to have metaclass in the class statement, not just meta. -Xav On 31 August 2010 00:16, Xavier Ho wrote: > Ethan, are you trying to write the constructor in the class statement? > > Cheers, > Xav > > > On 31 August 2010 00:10, Ethan Furman wrote:

Re: meta-class troubles

2010-08-30 Thread Xavier Ho
Ethan, are you trying to write the constructor in the class statement? Cheers, Xav On 31 August 2010 00:10, Ethan Furman wrote: > Good Day! > > I am stuck... hopefully a few fresh pairs of eyes will spot what I am > missing. > > I have a metaclass, Traits, and two different testing files, test_

Re: meta-class troubles

2010-08-30 Thread Chris Rebert
On Mon, Aug 30, 2010 at 7:10 AM, Ethan Furman wrote: > Good Day! > > I am stuck... hopefully a few fresh pairs of eyes will spot what I am > missing. > > I have a metaclass, Traits, and two different testing files, test_traits.py > and tests.py.  test_traits works fine, tests generates the followi

meta-class troubles

2010-08-30 Thread Ethan Furman
Good Day! I am stuck... hopefully a few fresh pairs of eyes will spot what I am missing. I have a metaclass, Traits, and two different testing files, test_traits.py and tests.py. test_traits works fine, tests generates the following error: C:\Python31\Lib\site-packages\traits\tests>\pytho

Re: __getattribute__ meta class?

2008-02-27 Thread bambam
"Carl Banks" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Feb 27, 12:44 am, "bambam" <[EMAIL PROTECTED]> wrote: >> In retrospect, the project has three parts: remove >> side effects, push side effects to a common location, modify code so that >> changes only affect areas that

Re: __getattribute__ meta class?

2008-02-27 Thread Carl Banks
On Feb 27, 12:44 am, "bambam" <[EMAIL PROTECTED]> wrote: > In retrospect, the project has three parts: remove > side effects, push side effects to a common location, modify code so that > changes only affect areas that encapsulate side effects. This code allows > top level code to pretend that the

Re: __getattribute__ meta class?

2008-02-26 Thread bambam
re introduced: 'type' and 'super'. ...That part is still opaque to me... I also don't know why the example meta class is derived from 'type'. The project is to interchangeably replace an object with a similar group of objects. The original project was not built

Re: __getattribute__ meta class?

2008-02-26 Thread grflanagan
On Feb 26, 3:43 am, "bambam" <[EMAIL PROTECTED]> wrote: > I have a class containing a series of classes like this: > > class Th(Externaldevice): > class _Communicate(commandset2.CommandSet_Communicate): > def __getattribute__(self,attrname): > attr = > commandset2.CommandSet_Communicate

Re: __getattribute__ meta class?

2008-02-25 Thread Carl Banks
On Feb 25, 9:43 pm, "bambam" <[EMAIL PROTECTED]> wrote: > I have a class containing a series of classes like this: > > class Th(Externaldevice): > class _Communicate(commandset2.CommandSet_Communicate): > def __getattribute__(self,attrname): > attr = > commandset2.CommandSet_Communicate

__getattribute__ meta class?

2008-02-25 Thread bambam
I have a class containing a series of classes like this: class Th(Externaldevice): class _Communicate(commandset2.CommandSet_Communicate): def __getattribute__(self,attrname): attr = commandset2.CommandSet_Communicate.__getattribute__(self,attrname) if "__call__" in dir(attr):

Re: Meta Class

2008-02-04 Thread Trevor Johnson
You're right I totally misunderstood it. And your idea is obvious and simple enough :) On Feb 1, 2008 6:33 PM, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > En Fri, 01 Feb 2008 15:46:05 -0200, Trevor Johnson > <[EMAIL PROTECTED]> escribió: > > > I think I have a

Re: Meta Class

2008-02-01 Thread Gabriel Genellina
En Fri, 01 Feb 2008 15:46:05 -0200, Trevor Johnson <[EMAIL PROTECTED]> escribió: > I think I have a good candidate for a meta class here. Never done this > before and would like someone to help. In the code that follows, there is > one variable that needs to be changed: th

Meta Class

2008-02-01 Thread Trevor Johnson
Hi; I think I have a good candidate for a meta class here. Never done this before and would like someone to help. In the code that follows, there is one variable that needs to be changed: the letter 'a' as inserted in construction of the variable 'word'. In other applicat