On Sep 7, 1:53 pm, Steve Holden <[EMAIL PROTECTED]> wrote:
> All you really need is to create your SplinterBorgs with appropriate
> group names, you don't neef subclasses at all:
oops, I tried this once and the link broke. I'll try tinyurl.
Dang. With that subject heading I thought this was abou
On Sep 7, 1:53 pm, Steve Holden <[EMAIL PROTECTED]> wrote:
> All you really need is to create your SplinterBorgs with appropriate
> group names, you don't neef subclasses at all:
>
Dang. With that subject heading I thought this was about some post-
Singularity, Python-programmed cyborgs rising up
On Fri, 2007-09-07 at 14:54 -0600, Steven Bethard wrote:
> Carsten Haese wrote:
> > [slightly convoluted example...]
>
> I think I would probably write that as::
> [concise example...]
>
> That is, I don't think there's really a need for __new__ if you're using
> a metaclass. Just set the instan
Carsten Haese wrote:
> Indeed, if you have an __init__ method that shouldn't see the "group"
> argument, you need a metaclass after all so you can yank the "group"
> argument between __new__ and __init__. The following code seems to work,
> but it's making my brain hurt:
>
> class SplinterBorgMeta
On Sep 7, 4:00 pm, Carsten Haese <[EMAIL PROTECTED]> wrote:
> On Fri, 2007-09-07 at 15:54 +, André wrote:
> > Unfortunately, it fails. Here's what I tried, followed by the
> > traceback
> > class SplinterBorg(object):
> > _shared_states = {}
> > def __new__(cls, *a, **k):
> > g
On Sep 7, 3:53 pm, Steve Holden <[EMAIL PROTECTED]> wrote:
> André wrote:
> > On Sep 7, 10:27 am, Carsten Haese <[EMAIL PROTECTED]> wrote:
> >> On Fri, 2007-09-07 at 12:31 +, André wrote:
> >>> In my application, I make use of the Borg idiom, invented by Alex
> >>> Martelli.
> >>> class Borg(ob
On Fri, 2007-09-07 at 15:54 +, André wrote:
> Unfortunately, it fails. Here's what I tried, followed by the
> traceback
> class SplinterBorg(object):
> _shared_states = {}
> def __new__(cls, *a, **k):
> group = k.pop("group","BORG")
> obj = object.__new__(cls, *a, **k)
André wrote:
> On Sep 7, 10:27 am, Carsten Haese <[EMAIL PROTECTED]> wrote:
>> On Fri, 2007-09-07 at 12:31 +, André wrote:
>>> In my application, I make use of the Borg idiom, invented by Alex
>>> Martelli.
>>> class Borg(object):
>>> '''Borg Idiom, from the Python Cookbook, 2nd Edition, p:
On Sep 7, 10:27 am, Carsten Haese <[EMAIL PROTECTED]> wrote:
> On Fri, 2007-09-07 at 12:31 +, André wrote:
> > In my application, I make use of the Borg idiom, invented by Alex
> > Martelli.
>
> > class Borg(object):
> > '''Borg Idiom, from the Python Cookbook, 2nd Edition, p:273
>
> >
On Fri, 2007-09-07 at 12:31 +, André wrote:
> In my application, I make use of the Borg idiom, invented by Alex
> Martelli.
>
> class Borg(object):
> '''Borg Idiom, from the Python Cookbook, 2nd Edition, p:273
>
> Derive a class form this; all instances of that class will share
> the
In my application, I make use of the Borg idiom, invented by Alex
Martelli.
class Borg(object):
'''Borg Idiom, from the Python Cookbook, 2nd Edition, p:273
Derive a class form this; all instances of that class will share
the
same state, provided that they don't override __new__; other
11 matches
Mail list logo